linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3.12 001/170] Revert "aio: fix kernel memory disclosure in io_getevents() introduced in v3.10"
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 002/170] ipvs: stop tot_stats estimator only under CONFIG_SYSCTL Jiri Slaby
                   ` (169 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Jiri Slaby, Benjamin LaHaise, Mateusz Guzik,
	Petr Matousek, Kent Overstreet, Jeff Moyer

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

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

This reverts commit 0e2e24e5dc6eb6f0698e9dc97e652f132b885624, which
was applied twice mistakenly. The first one is
bee3f7b8188d4b2a5dfaeb2eb4a68d99f67daecf.

Reported-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Benjamin LaHaise <bcrl@kvack.org>
Cc: Mateusz Guzik <mguzik@redhat.com>
Cc: Petr Matousek <pmatouse@redhat.com>
Cc: Kent Overstreet <kmo@daterainc.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
---
 fs/aio.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/aio.c b/fs/aio.c
index 0abde33de70e..e609e15f36b9 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1066,9 +1066,6 @@ static long aio_read_events_ring(struct kioctx *ctx,
 	head %= ctx->nr_events;
 	tail %= ctx->nr_events;
 
-	head %= ctx->nr_events;
-	tail %= ctx->nr_events;
-
 	while (ret < nr) {
 		long avail;
 		struct io_event *ev;
-- 
2.0.0


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

* [PATCH 3.12 002/170] ipvs: stop tot_stats estimator only under CONFIG_SYSCTL
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 001/170] Revert "aio: fix kernel memory disclosure in io_getevents() introduced in v3.10" Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 003/170] netfilter: nf_nat: fix oops on netns removal Jiri Slaby
                   ` (168 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Julian Anastasov, Jiri Slaby

From: Julian Anastasov <ja@ssi.bg>

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

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

[ Upstream commit 9802d21e7a0b0d2167ef745edc1f4ea7a0fc6ea3 ]

The tot_stats estimator is started only when CONFIG_SYSCTL
is defined. But it is stopped without checking CONFIG_SYSCTL.
Fix the crash by moving ip_vs_stop_estimator into
ip_vs_control_net_cleanup_sysctl.

The change is needed after commit 14e405461e664b
("IPVS: Add __ip_vs_control_{init,cleanup}_sysctl()") from 2.6.39.

Cc: <stable@vger.kernel.org> # 3.15.x
Cc: <stable@vger.kernel.org> # 3.14.x
Cc: <stable@vger.kernel.org> # 3.12.x
Cc: <stable@vger.kernel.org> # 3.10.x
Cc: <stable@vger.kernel.org> # 3.2.x
Reported-by: Jet Chen <jet.chen@intel.com>
Tested-by: Jet Chen <jet.chen@intel.com>
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Sgned-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/netfilter/ipvs/ip_vs_ctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index a3df9bddc4f7..f9568654ffd2 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -3765,6 +3765,7 @@ static void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net)
 	cancel_delayed_work_sync(&ipvs->defense_work);
 	cancel_work_sync(&ipvs->defense_work.work);
 	unregister_net_sysctl_table(ipvs->sysctl_hdr);
+	ip_vs_stop_estimator(net, &ipvs->tot_stats);
 }
 
 #else
@@ -3825,7 +3826,6 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net)
 	 */
 	rcu_barrier();
 	ip_vs_trash_cleanup(net);
-	ip_vs_stop_estimator(net, &ipvs->tot_stats);
 	ip_vs_control_net_cleanup_sysctl(net);
 	remove_proc_entry("ip_vs_stats_percpu", net->proc_net);
 	remove_proc_entry("ip_vs_stats", net->proc_net);
-- 
2.0.0


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

* [PATCH 3.12 003/170] netfilter: nf_nat: fix oops on netns removal
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 001/170] Revert "aio: fix kernel memory disclosure in io_getevents() introduced in v3.10" Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 002/170] ipvs: stop tot_stats estimator only under CONFIG_SYSCTL Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 004/170] rtmutex: Fix deadlock detector for real Jiri Slaby
                   ` (167 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Florian Westphal, Pablo Neira Ayuso, Jiri Slaby

From: Florian Westphal <fw@strlen.de>

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

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

[ Upstream commit 945b2b2d259d1a4364a2799e80e8ff32f8c6ee6f ]

Quoting Samu Kallio:

 Basically what's happening is, during netns cleanup,
 nf_nat_net_exit gets called before ipv4_net_exit. As I understand
 it, nf_nat_net_exit is supposed to kill any conntrack entries which
 have NAT context (through nf_ct_iterate_cleanup), but for some
 reason this doesn't happen (perhaps something else is still holding
 refs to those entries?).

 When ipv4_net_exit is called, conntrack entries (including those
 with NAT context) are cleaned up, but the
 nat_bysource hashtable is long gone - freed in nf_nat_net_exit. The
 bug happens when attempting to free a conntrack entry whose NAT hash
 'prev' field points to a slot in the freed hash table (head for that
 bin).

We ignore conntracks with null nat bindings.  But this is wrong,
as these are in bysource hash table as well.

Restore nat-cleaning for the netns-is-being-removed case.

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

Cc: <stable@vger.kernel.org> # 3.15.x
Cc: <stable@vger.kernel.org> # 3.14.x
Cc: <stable@vger.kernel.org> # 3.12.x
Cc: <stable@vger.kernel.org> # 3.10.x
Fixes: c2d421e1718 ('netfilter: nf_nat: fix race when unloading protocol modules')
Reported-by: Samu Kallio <samu.kallio@aberdeencloud.com>
Debugged-by: Samu Kallio <samu.kallio@aberdeencloud.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Tested-by: Samu Kallio <samu.kallio@aberdeencloud.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/netfilter/nf_nat_core.c | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c
index 6f0f4f7f68a5..13deb61737f8 100644
--- a/net/netfilter/nf_nat_core.c
+++ b/net/netfilter/nf_nat_core.c
@@ -491,6 +491,39 @@ static int nf_nat_proto_remove(struct nf_conn *i, void *data)
 	return i->status & IPS_NAT_MASK ? 1 : 0;
 }
 
+static int nf_nat_proto_clean(struct nf_conn *ct, void *data)
+{
+	struct nf_conn_nat *nat = nfct_nat(ct);
+
+	if (nf_nat_proto_remove(ct, data))
+		return 1;
+
+	if (!nat || !nat->ct)
+		return 0;
+
+	/* This netns is being destroyed, and conntrack has nat null binding.
+	 * Remove it from bysource hash, as the table will be freed soon.
+	 *
+	 * Else, when the conntrack is destoyed, nf_nat_cleanup_conntrack()
+	 * will delete entry from already-freed table.
+	 */
+	if (!del_timer(&ct->timeout))
+		return 1;
+
+	spin_lock_bh(&nf_nat_lock);
+	hlist_del_rcu(&nat->bysource);
+	ct->status &= ~IPS_NAT_DONE_MASK;
+	nat->ct = NULL;
+	spin_unlock_bh(&nf_nat_lock);
+
+	add_timer(&ct->timeout);
+
+	/* don't delete conntrack.  Although that would make things a lot
+	 * simpler, we'd end up flushing all conntracks on nat rmmod.
+	 */
+	return 0;
+}
+
 static void nf_nat_l4proto_clean(u8 l3proto, u8 l4proto)
 {
 	struct nf_nat_proto_clean clean = {
@@ -753,7 +786,7 @@ static void __net_exit nf_nat_net_exit(struct net *net)
 {
 	struct nf_nat_proto_clean clean = {};
 
-	nf_ct_iterate_cleanup(net, &nf_nat_proto_remove, &clean, 0, 0);
+	nf_ct_iterate_cleanup(net, nf_nat_proto_clean, &clean, 0, 0);
 	synchronize_rcu();
 	nf_ct_free_hashtable(net->ct.nat_bysource, net->ct.nat_htable_size);
 }
-- 
2.0.0


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

* [PATCH 3.12 004/170] rtmutex: Fix deadlock detector for real
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (2 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 003/170] netfilter: nf_nat: fix oops on netns removal Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 005/170] rtmutex: Detect changes in the pi lock chain Jiri Slaby
                   ` (166 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Thomas Gleixner, Peter Zijlstra, Lai Jiangshan,
	Mike Galbraith, Jiri Slaby

From: Thomas Gleixner <tglx@linutronix.de>

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

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

commit 397335f004f41e5fcf7a795e94eb3ab83411a17c upstream.

The current deadlock detection logic does not work reliably due to the
following early exit path:

	/*
	 * Drop out, when the task has no waiters. Note,
	 * top_waiter can be NULL, when we are in the deboosting
	 * mode!
	 */
	if (top_waiter && (!task_has_pi_waiters(task) ||
			   top_waiter != task_top_pi_waiter(task)))
		goto out_unlock_pi;

So this not only exits when the task has no waiters, it also exits
unconditionally when the current waiter is not the top priority waiter
of the task.

So in a nested locking scenario, it might abort the lock chain walk
and therefor miss a potential deadlock.

Simple fix: Continue the chain walk, when deadlock detection is
enabled.

We also avoid the whole enqueue, if we detect the deadlock right away
(A-A). It's an optimization, but also prevents that another waiter who
comes in after the detection and before the task has undone the damage
observes the situation and detects the deadlock and returns
-EDEADLOCK, which is wrong as the other task is not in a deadlock
situation.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Link: http://lkml.kernel.org/r/20140522031949.725272460@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/rtmutex.c | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index 0dd6aec1cb6a..16d5356ce45b 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -225,9 +225,16 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
 	 * top_waiter can be NULL, when we are in the deboosting
 	 * mode!
 	 */
-	if (top_waiter && (!task_has_pi_waiters(task) ||
-			   top_waiter != task_top_pi_waiter(task)))
-		goto out_unlock_pi;
+	if (top_waiter) {
+		if (!task_has_pi_waiters(task))
+			goto out_unlock_pi;
+		/*
+		 * If deadlock detection is off, we stop here if we
+		 * are not the top pi waiter of the task.
+		 */
+		if (!detect_deadlock && top_waiter != task_top_pi_waiter(task))
+			goto out_unlock_pi;
+	}
 
 	/*
 	 * When deadlock detection is off then we check, if further
@@ -243,7 +250,12 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
 		goto retry;
 	}
 
-	/* Deadlock detection */
+	/*
+	 * Deadlock detection. If the lock is the same as the original
+	 * lock which caused us to walk the lock chain or if the
+	 * current lock is owned by the task which initiated the chain
+	 * walk, we detected a deadlock.
+	 */
 	if (lock == orig_lock || rt_mutex_owner(lock) == top_task) {
 		debug_rt_mutex_deadlock(deadlock_detect, orig_waiter, lock);
 		raw_spin_unlock(&lock->wait_lock);
@@ -412,6 +424,18 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
 	unsigned long flags;
 	int chain_walk = 0, res;
 
+	/*
+	 * Early deadlock detection. We really don't want the task to
+	 * enqueue on itself just to untangle the mess later. It's not
+	 * only an optimization. We drop the locks, so another waiter
+	 * can come in before the chain walk detects the deadlock. So
+	 * the other will detect the deadlock and return -EDEADLOCK,
+	 * which is wrong, as the other waiter is not in a deadlock
+	 * situation.
+	 */
+	if (detect_deadlock && owner == task)
+		return -EDEADLK;
+
 	raw_spin_lock_irqsave(&task->pi_lock, flags);
 	__rt_mutex_adjust_prio(task);
 	waiter->task = task;
-- 
2.0.0


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

* [PATCH 3.12 005/170] rtmutex: Detect changes in the pi lock chain
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (3 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 004/170] rtmutex: Fix deadlock detector for real Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 006/170] rtmutex: Handle deadlock detection smarter Jiri Slaby
                   ` (165 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Thomas Gleixner, Steven Rostedt, Peter Zijlstra,
	Mike Galbraith, Jiri Slaby

From: Thomas Gleixner <tglx@linutronix.de>

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

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

commit 82084984383babe728e6e3c9a8e5c46278091315 upstream.

When we walk the lock chain, we drop all locks after each step. So the
lock chain can change under us before we reacquire the locks. That's
harmless in principle as we just follow the wrong lock path. But it
can lead to a false positive in the dead lock detection logic:

T0 holds L0
T0 blocks on L1 held by T1
T1 blocks on L2 held by T2
T2 blocks on L3 held by T3
T4 blocks on L4 held by T4

Now we walk the chain

lock T1 -> lock L2 -> adjust L2 -> unlock T1 ->
     lock T2 ->  adjust T2 ->  drop locks

T2 times out and blocks on L0

Now we continue:

lock T2 -> lock L0 -> deadlock detected, but it's not a deadlock at all.

Brad tried to work around that in the deadlock detection logic itself,
but the more I looked at it the less I liked it, because it's crystal
ball magic after the fact.

We actually can detect a chain change very simple:

lock T1 -> lock L2 -> adjust L2 -> unlock T1 -> lock T2 -> adjust T2 ->

     next_lock = T2->pi_blocked_on->lock;

drop locks

T2 times out and blocks on L0

Now we continue:

lock T2 ->

     if (next_lock != T2->pi_blocked_on->lock)
     	   return;

So if we detect that T2 is now blocked on a different lock we stop the
chain walk. That's also correct in the following scenario:

lock T1 -> lock L2 -> adjust L2 -> unlock T1 -> lock T2 -> adjust T2 ->

     next_lock = T2->pi_blocked_on->lock;

drop locks

T3 times out and drops L3
T2 acquires L3 and blocks on L4 now

Now we continue:

lock T2 ->

     if (next_lock != T2->pi_blocked_on->lock)
     	   return;

We don't have to follow up the chain at that point, because T2
propagated our priority up to T4 already.

[ Folded a cleanup patch from peterz ]

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reported-by: Brad Mouring <bmouring@ni.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20140605152801.930031935@linutronix.de
Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/rtmutex.c | 95 ++++++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 71 insertions(+), 24 deletions(-)

diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index 16d5356ce45b..c343cc9702af 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -142,27 +142,36 @@ static void rt_mutex_adjust_prio(struct task_struct *task)
  */
 int max_lock_depth = 1024;
 
+static inline struct rt_mutex *task_blocked_on_lock(struct task_struct *p)
+{
+	return p->pi_blocked_on ? p->pi_blocked_on->lock : NULL;
+}
+
 /*
  * Adjust the priority chain. Also used for deadlock detection.
  * Decreases task's usage by one - may thus free the task.
  *
- * @task: the task owning the mutex (owner) for which a chain walk is probably
- *	  needed
+ * @task:	the task owning the mutex (owner) for which a chain walk is
+ *		probably needed
  * @deadlock_detect: do we have to carry out deadlock detection?
- * @orig_lock: the mutex (can be NULL if we are walking the chain to recheck
- * 	       things for a task that has just got its priority adjusted, and
- *	       is waiting on a mutex)
+ * @orig_lock:	the mutex (can be NULL if we are walking the chain to recheck
+ *		things for a task that has just got its priority adjusted, and
+ *		is waiting on a mutex)
+ * @next_lock:	the mutex on which the owner of @orig_lock was blocked before
+ *		we dropped its pi_lock. Is never dereferenced, only used for
+ *		comparison to detect lock chain changes.
  * @orig_waiter: rt_mutex_waiter struct for the task that has just donated
- *		 its priority to the mutex owner (can be NULL in the case
- *		 depicted above or if the top waiter is gone away and we are
- *		 actually deboosting the owner)
- * @top_task: the current top waiter
+ *		its priority to the mutex owner (can be NULL in the case
+ *		depicted above or if the top waiter is gone away and we are
+ *		actually deboosting the owner)
+ * @top_task:	the current top waiter
  *
  * Returns 0 or -EDEADLK.
  */
 static int rt_mutex_adjust_prio_chain(struct task_struct *task,
 				      int deadlock_detect,
 				      struct rt_mutex *orig_lock,
+				      struct rt_mutex *next_lock,
 				      struct rt_mutex_waiter *orig_waiter,
 				      struct task_struct *top_task)
 {
@@ -221,6 +230,18 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
 		goto out_unlock_pi;
 
 	/*
+	 * We dropped all locks after taking a refcount on @task, so
+	 * the task might have moved on in the lock chain or even left
+	 * the chain completely and blocks now on an unrelated lock or
+	 * on @orig_lock.
+	 *
+	 * We stored the lock on which @task was blocked in @next_lock,
+	 * so we can detect the chain change.
+	 */
+	if (next_lock != waiter->lock)
+		goto out_unlock_pi;
+
+	/*
 	 * Drop out, when the task has no waiters. Note,
 	 * top_waiter can be NULL, when we are in the deboosting
 	 * mode!
@@ -306,11 +327,26 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
 		__rt_mutex_adjust_prio(task);
 	}
 
+	/*
+	 * Check whether the task which owns the current lock is pi
+	 * blocked itself. If yes we store a pointer to the lock for
+	 * the lock chain change detection above. After we dropped
+	 * task->pi_lock next_lock cannot be dereferenced anymore.
+	 */
+	next_lock = task_blocked_on_lock(task);
+
 	raw_spin_unlock_irqrestore(&task->pi_lock, flags);
 
 	top_waiter = rt_mutex_top_waiter(lock);
 	raw_spin_unlock(&lock->wait_lock);
 
+	/*
+	 * We reached the end of the lock chain. Stop right here. No
+	 * point to go back just to figure that out.
+	 */
+	if (!next_lock)
+		goto out_put_task;
+
 	if (!detect_deadlock && waiter != top_waiter)
 		goto out_put_task;
 
@@ -421,8 +457,9 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
 {
 	struct task_struct *owner = rt_mutex_owner(lock);
 	struct rt_mutex_waiter *top_waiter = waiter;
-	unsigned long flags;
+	struct rt_mutex *next_lock;
 	int chain_walk = 0, res;
+	unsigned long flags;
 
 	/*
 	 * Early deadlock detection. We really don't want the task to
@@ -455,20 +492,28 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
 	if (!owner)
 		return 0;
 
+	raw_spin_lock_irqsave(&owner->pi_lock, flags);
 	if (waiter == rt_mutex_top_waiter(lock)) {
-		raw_spin_lock_irqsave(&owner->pi_lock, flags);
 		plist_del(&top_waiter->pi_list_entry, &owner->pi_waiters);
 		plist_add(&waiter->pi_list_entry, &owner->pi_waiters);
 
 		__rt_mutex_adjust_prio(owner);
 		if (owner->pi_blocked_on)
 			chain_walk = 1;
-		raw_spin_unlock_irqrestore(&owner->pi_lock, flags);
-	}
-	else if (debug_rt_mutex_detect_deadlock(waiter, detect_deadlock))
+	} else if (debug_rt_mutex_detect_deadlock(waiter, detect_deadlock)) {
 		chain_walk = 1;
+	}
 
-	if (!chain_walk)
+	/* Store the lock on which owner is blocked or NULL */
+	next_lock = task_blocked_on_lock(owner);
+
+	raw_spin_unlock_irqrestore(&owner->pi_lock, flags);
+	/*
+	 * Even if full deadlock detection is on, if the owner is not
+	 * blocked itself, we can avoid finding this out in the chain
+	 * walk.
+	 */
+	if (!chain_walk || !next_lock)
 		return 0;
 
 	/*
@@ -480,8 +525,8 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
 
 	raw_spin_unlock(&lock->wait_lock);
 
-	res = rt_mutex_adjust_prio_chain(owner, detect_deadlock, lock, waiter,
-					 task);
+	res = rt_mutex_adjust_prio_chain(owner, detect_deadlock, lock,
+					 next_lock, waiter, task);
 
 	raw_spin_lock(&lock->wait_lock);
 
@@ -530,8 +575,8 @@ static void remove_waiter(struct rt_mutex *lock,
 {
 	int first = (waiter == rt_mutex_top_waiter(lock));
 	struct task_struct *owner = rt_mutex_owner(lock);
+	struct rt_mutex *next_lock = NULL;
 	unsigned long flags;
-	int chain_walk = 0;
 
 	raw_spin_lock_irqsave(&current->pi_lock, flags);
 	plist_del(&waiter->list_entry, &lock->wait_list);
@@ -555,15 +600,15 @@ static void remove_waiter(struct rt_mutex *lock,
 		}
 		__rt_mutex_adjust_prio(owner);
 
-		if (owner->pi_blocked_on)
-			chain_walk = 1;
+		/* Store the lock on which owner is blocked or NULL */
+		next_lock = task_blocked_on_lock(owner);
 
 		raw_spin_unlock_irqrestore(&owner->pi_lock, flags);
 	}
 
 	WARN_ON(!plist_node_empty(&waiter->pi_list_entry));
 
-	if (!chain_walk)
+	if (!next_lock)
 		return;
 
 	/* gets dropped in rt_mutex_adjust_prio_chain()! */
@@ -571,7 +616,7 @@ static void remove_waiter(struct rt_mutex *lock,
 
 	raw_spin_unlock(&lock->wait_lock);
 
-	rt_mutex_adjust_prio_chain(owner, 0, lock, NULL, current);
+	rt_mutex_adjust_prio_chain(owner, 0, lock, next_lock, NULL, current);
 
 	raw_spin_lock(&lock->wait_lock);
 }
@@ -584,6 +629,7 @@ static void remove_waiter(struct rt_mutex *lock,
 void rt_mutex_adjust_pi(struct task_struct *task)
 {
 	struct rt_mutex_waiter *waiter;
+	struct rt_mutex *next_lock;
 	unsigned long flags;
 
 	raw_spin_lock_irqsave(&task->pi_lock, flags);
@@ -593,12 +639,13 @@ void rt_mutex_adjust_pi(struct task_struct *task)
 		raw_spin_unlock_irqrestore(&task->pi_lock, flags);
 		return;
 	}
-
+	next_lock = waiter->lock;
 	raw_spin_unlock_irqrestore(&task->pi_lock, flags);
 
 	/* gets dropped in rt_mutex_adjust_prio_chain()! */
 	get_task_struct(task);
-	rt_mutex_adjust_prio_chain(task, 0, NULL, NULL, task);
+
+	rt_mutex_adjust_prio_chain(task, 0, NULL, next_lock, NULL, task);
 }
 
 /**
-- 
2.0.0


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

* [PATCH 3.12 006/170] rtmutex: Handle deadlock detection smarter
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (4 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 005/170] rtmutex: Detect changes in the pi lock chain Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 007/170] rtmutex: Plug slow unlock race Jiri Slaby
                   ` (164 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Thomas Gleixner, Steven Rostedt, Peter Zijlstra,
	Brad Mouring, Mike Galbraith, Jiri Slaby

From: Thomas Gleixner <tglx@linutronix.de>

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

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

commit 3d5c9340d1949733eb37616abd15db36aef9a57c upstream.

Even in the case when deadlock detection is not requested by the
caller, we can detect deadlocks. Right now the code stops the lock
chain walk and keeps the waiter enqueued, even on itself. Silly not to
yell when such a scenario is detected and to keep the waiter enqueued.

Return -EDEADLK unconditionally and handle it at the call sites.

The futex calls return -EDEADLK. The non futex ones dequeue the
waiter, throw a warning and put the task into a schedule loop.

Tagged for stable as it makes the code more robust.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Brad Mouring <bmouring@ni.com>
Link: http://lkml.kernel.org/r/20140605152801.836501969@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/rtmutex-debug.h |  5 +++++
 kernel/rtmutex.c       | 33 ++++++++++++++++++++++++++++-----
 kernel/rtmutex.h       |  5 +++++
 3 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/kernel/rtmutex-debug.h b/kernel/rtmutex-debug.h
index 14193d596d78..ab29b6a22669 100644
--- a/kernel/rtmutex-debug.h
+++ b/kernel/rtmutex-debug.h
@@ -31,3 +31,8 @@ static inline int debug_rt_mutex_detect_deadlock(struct rt_mutex_waiter *waiter,
 {
 	return (waiter != NULL);
 }
+
+static inline void rt_mutex_print_deadlock(struct rt_mutex_waiter *w)
+{
+	debug_rt_mutex_print_deadlock(w);
+}
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index c343cc9702af..ff24a43f192f 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -205,7 +205,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
 		}
 		put_task_struct(task);
 
-		return deadlock_detect ? -EDEADLK : 0;
+		return -EDEADLK;
 	}
  retry:
 	/*
@@ -280,7 +280,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
 	if (lock == orig_lock || rt_mutex_owner(lock) == top_task) {
 		debug_rt_mutex_deadlock(deadlock_detect, orig_waiter, lock);
 		raw_spin_unlock(&lock->wait_lock);
-		ret = deadlock_detect ? -EDEADLK : 0;
+		ret = -EDEADLK;
 		goto out_unlock_pi;
 	}
 
@@ -470,7 +470,7 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
 	 * which is wrong, as the other waiter is not in a deadlock
 	 * situation.
 	 */
-	if (detect_deadlock && owner == task)
+	if (owner == task)
 		return -EDEADLK;
 
 	raw_spin_lock_irqsave(&task->pi_lock, flags);
@@ -697,6 +697,26 @@ __rt_mutex_slowlock(struct rt_mutex *lock, int state,
 	return ret;
 }
 
+static void rt_mutex_handle_deadlock(int res, int detect_deadlock,
+				     struct rt_mutex_waiter *w)
+{
+	/*
+	 * If the result is not -EDEADLOCK or the caller requested
+	 * deadlock detection, nothing to do here.
+	 */
+	if (res != -EDEADLOCK || detect_deadlock)
+		return;
+
+	/*
+	 * Yell lowdly and stop the task right here.
+	 */
+	rt_mutex_print_deadlock(w);
+	while (1) {
+		set_current_state(TASK_INTERRUPTIBLE);
+		schedule();
+	}
+}
+
 /*
  * Slow path lock function:
  */
@@ -734,8 +754,10 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state,
 
 	set_current_state(TASK_RUNNING);
 
-	if (unlikely(ret))
+	if (unlikely(ret)) {
 		remove_waiter(lock, &waiter);
+		rt_mutex_handle_deadlock(ret, detect_deadlock, &waiter);
+	}
 
 	/*
 	 * try_to_take_rt_mutex() sets the waiter bit
@@ -1043,7 +1065,8 @@ int rt_mutex_start_proxy_lock(struct rt_mutex *lock,
 		return 1;
 	}
 
-	ret = task_blocks_on_rt_mutex(lock, waiter, task, detect_deadlock);
+	/* We enforce deadlock detection for futexes */
+	ret = task_blocks_on_rt_mutex(lock, waiter, task, 1);
 
 	if (ret && !rt_mutex_owner(lock)) {
 		/*
diff --git a/kernel/rtmutex.h b/kernel/rtmutex.h
index a1a1dd06421d..f6a1f3c133b1 100644
--- a/kernel/rtmutex.h
+++ b/kernel/rtmutex.h
@@ -24,3 +24,8 @@
 #define debug_rt_mutex_print_deadlock(w)		do { } while (0)
 #define debug_rt_mutex_detect_deadlock(w,d)		(d)
 #define debug_rt_mutex_reset_waiter(w)			do { } while (0)
+
+static inline void rt_mutex_print_deadlock(struct rt_mutex_waiter *w)
+{
+	WARN(1, "rtmutex deadlock detected\n");
+}
-- 
2.0.0


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

* [PATCH 3.12 007/170] rtmutex: Plug slow unlock race
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (5 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 006/170] rtmutex: Handle deadlock detection smarter Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 008/170] target: Fix left-over se_lun->lun_sep pointer OOPs Jiri Slaby
                   ` (163 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Thomas Gleixner, Peter Zijlstra, Mike Galbraith,
	Jiri Slaby

From: Thomas Gleixner <tglx@linutronix.de>

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

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

commit 27e35715df54cbc4f2d044f681802ae30479e7fb upstream.

When the rtmutex fast path is enabled the slow unlock function can
create the following situation:

spin_lock(foo->m->wait_lock);
foo->m->owner = NULL;
	    			rt_mutex_lock(foo->m); <-- fast path
				free = atomic_dec_and_test(foo->refcnt);
				rt_mutex_unlock(foo->m); <-- fast path
				if (free)
				   kfree(foo);

spin_unlock(foo->m->wait_lock); <--- Use after free.

Plug the race by changing the slow unlock to the following scheme:

     while (!rt_mutex_has_waiters(m)) {
     	    /* Clear the waiters bit in m->owner */
	    clear_rt_mutex_waiters(m);
      	    owner = rt_mutex_owner(m);
      	    spin_unlock(m->wait_lock);
      	    if (cmpxchg(m->owner, owner, 0) == owner)
      	       return;
      	    spin_lock(m->wait_lock);
     }

So in case of a new waiter incoming while the owner tries the slow
path unlock we have two situations:

 unlock(wait_lock);
					lock(wait_lock);
 cmpxchg(p, owner, 0) == owner
 	    	   			mark_rt_mutex_waiters(lock);
	 				acquire(lock);

Or:

 unlock(wait_lock);
					lock(wait_lock);
	 				mark_rt_mutex_waiters(lock);
 cmpxchg(p, owner, 0) != owner
					enqueue_waiter();
					unlock(wait_lock);
 lock(wait_lock);
 wakeup_next waiter();
 unlock(wait_lock);
					lock(wait_lock);
					acquire(lock);

If the fast path is disabled, then the simple

   m->owner = NULL;
   unlock(m->wait_lock);

is sufficient as all access to m->owner is serialized via
m->wait_lock;

Also document and clarify the wakeup_next_waiter function as suggested
by Oleg Nesterov.

Reported-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20140611183852.937945560@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/rtmutex.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 109 insertions(+), 6 deletions(-)

diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index ff24a43f192f..51a83343df68 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -82,6 +82,47 @@ static inline void mark_rt_mutex_waiters(struct rt_mutex *lock)
 		owner = *p;
 	} while (cmpxchg(p, owner, owner | RT_MUTEX_HAS_WAITERS) != owner);
 }
+
+/*
+ * Safe fastpath aware unlock:
+ * 1) Clear the waiters bit
+ * 2) Drop lock->wait_lock
+ * 3) Try to unlock the lock with cmpxchg
+ */
+static inline bool unlock_rt_mutex_safe(struct rt_mutex *lock)
+	__releases(lock->wait_lock)
+{
+	struct task_struct *owner = rt_mutex_owner(lock);
+
+	clear_rt_mutex_waiters(lock);
+	raw_spin_unlock(&lock->wait_lock);
+	/*
+	 * If a new waiter comes in between the unlock and the cmpxchg
+	 * we have two situations:
+	 *
+	 * unlock(wait_lock);
+	 *					lock(wait_lock);
+	 * cmpxchg(p, owner, 0) == owner
+	 *					mark_rt_mutex_waiters(lock);
+	 *					acquire(lock);
+	 * or:
+	 *
+	 * unlock(wait_lock);
+	 *					lock(wait_lock);
+	 *					mark_rt_mutex_waiters(lock);
+	 *
+	 * cmpxchg(p, owner, 0) != owner
+	 *					enqueue_waiter();
+	 *					unlock(wait_lock);
+	 * lock(wait_lock);
+	 * wake waiter();
+	 * unlock(wait_lock);
+	 *					lock(wait_lock);
+	 *					acquire(lock);
+	 */
+	return rt_mutex_cmpxchg(lock, owner, NULL);
+}
+
 #else
 # define rt_mutex_cmpxchg(l,c,n)	(0)
 static inline void mark_rt_mutex_waiters(struct rt_mutex *lock)
@@ -89,6 +130,17 @@ static inline void mark_rt_mutex_waiters(struct rt_mutex *lock)
 	lock->owner = (struct task_struct *)
 			((unsigned long)lock->owner | RT_MUTEX_HAS_WAITERS);
 }
+
+/*
+ * Simple slow path only version: lock->owner is protected by lock->wait_lock.
+ */
+static inline bool unlock_rt_mutex_safe(struct rt_mutex *lock)
+	__releases(lock->wait_lock)
+{
+	lock->owner = NULL;
+	raw_spin_unlock(&lock->wait_lock);
+	return true;
+}
 #endif
 
 /*
@@ -536,7 +588,8 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
 /*
  * Wake up the next waiter on the lock.
  *
- * Remove the top waiter from the current tasks waiter list and wake it up.
+ * Remove the top waiter from the current tasks pi waiter list and
+ * wake it up.
  *
  * Called with lock->wait_lock held.
  */
@@ -557,10 +610,23 @@ static void wakeup_next_waiter(struct rt_mutex *lock)
 	 */
 	plist_del(&waiter->pi_list_entry, &current->pi_waiters);
 
-	rt_mutex_set_owner(lock, NULL);
+	/*
+	 * As we are waking up the top waiter, and the waiter stays
+	 * queued on the lock until it gets the lock, this lock
+	 * obviously has waiters. Just set the bit here and this has
+	 * the added benefit of forcing all new tasks into the
+	 * slow path making sure no task of lower priority than
+	 * the top waiter can steal this lock.
+	 */
+	lock->owner = (void *) RT_MUTEX_HAS_WAITERS;
 
 	raw_spin_unlock_irqrestore(&current->pi_lock, flags);
 
+	/*
+	 * It's safe to dereference waiter as it cannot go away as
+	 * long as we hold lock->wait_lock. The waiter task needs to
+	 * acquire it in order to dequeue the waiter.
+	 */
 	wake_up_process(waiter->task);
 }
 
@@ -813,12 +879,49 @@ rt_mutex_slowunlock(struct rt_mutex *lock)
 
 	rt_mutex_deadlock_account_unlock(current);
 
-	if (!rt_mutex_has_waiters(lock)) {
-		lock->owner = NULL;
-		raw_spin_unlock(&lock->wait_lock);
-		return;
+	/*
+	 * We must be careful here if the fast path is enabled. If we
+	 * have no waiters queued we cannot set owner to NULL here
+	 * because of:
+	 *
+	 * foo->lock->owner = NULL;
+	 *			rtmutex_lock(foo->lock);   <- fast path
+	 *			free = atomic_dec_and_test(foo->refcnt);
+	 *			rtmutex_unlock(foo->lock); <- fast path
+	 *			if (free)
+	 *				kfree(foo);
+	 * raw_spin_unlock(foo->lock->wait_lock);
+	 *
+	 * So for the fastpath enabled kernel:
+	 *
+	 * Nothing can set the waiters bit as long as we hold
+	 * lock->wait_lock. So we do the following sequence:
+	 *
+	 *	owner = rt_mutex_owner(lock);
+	 *	clear_rt_mutex_waiters(lock);
+	 *	raw_spin_unlock(&lock->wait_lock);
+	 *	if (cmpxchg(&lock->owner, owner, 0) == owner)
+	 *		return;
+	 *	goto retry;
+	 *
+	 * The fastpath disabled variant is simple as all access to
+	 * lock->owner is serialized by lock->wait_lock:
+	 *
+	 *	lock->owner = NULL;
+	 *	raw_spin_unlock(&lock->wait_lock);
+	 */
+	while (!rt_mutex_has_waiters(lock)) {
+		/* Drops lock->wait_lock ! */
+		if (unlock_rt_mutex_safe(lock) == true)
+			return;
+		/* Relock the rtmutex and try again */
+		raw_spin_lock(&lock->wait_lock);
 	}
 
+	/*
+	 * The wakeup next waiter path does not suffer from the above
+	 * race. See the comments there.
+	 */
 	wakeup_next_waiter(lock);
 
 	raw_spin_unlock(&lock->wait_lock);
-- 
2.0.0


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

* [PATCH 3.12 008/170] target: Fix left-over se_lun->lun_sep pointer OOPs
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (6 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 007/170] rtmutex: Plug slow unlock race Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 009/170] iscsi-target: Avoid rejecting incorrect ITT for Data-Out Jiri Slaby
                   ` (162 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 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 83ff42fcce070801a3aa1cd6a3269d7426271a8d upstream.

This patch fixes a left-over se_lun->lun_sep pointer OOPs when one
of the /sys/kernel/config/target/$FABRIC/$WWPN/$TPGT/lun/$LUN/alua*
attributes is accessed after the $DEVICE symlink has been removed.

To address this bug, go ahead and clear se_lun->lun_sep memory in
core_dev_unexport(), so that the existing checks for show/store
ALUA attributes in target_core_fabric_configfs.c work as expected.

Reported-by: Sebastian Herbszt <herbszt@gmx.de>
Tested-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/target/target_core_device.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index e31ec5cf0c36..c7a3c5e2b1b3 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -617,6 +617,7 @@ void core_dev_unexport(
 	dev->export_count--;
 	spin_unlock(&hba->device_lock);
 
+	lun->lun_sep = NULL;
 	lun->lun_se_dev = NULL;
 }
 
-- 
2.0.0


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

* [PATCH 3.12 009/170] iscsi-target: Avoid rejecting incorrect ITT for Data-Out
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (7 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 008/170] target: Fix left-over se_lun->lun_sep pointer OOPs Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 010/170] iscsi-target: Explicily clear login response PDU in exception path Jiri Slaby
                   ` (161 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 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 97c99b47ac58bacb7c09e1f47d5d184434f6b06a upstream.

This patch changes iscsit_check_dataout_hdr() to dump the incoming
Data-Out payload when the received ITT is not associated with a
WRITE, instead of calling iscsit_reject_cmd() for the non WRITE
ITT descriptor.

This addresses a bug where an initiator sending an Data-Out for
an ITT associated with a READ would end up generating a reject
for the READ, eventually resulting in list corruption.

Reported-by: Santosh Kulkarni <santosh.kulkarni@calsoftinc.com>
Reported-by: Arshad Hussain <arshad.hussain@calsoftinc.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/target/iscsi/iscsi_target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index f99162542df2..d2ff40680208 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -1305,7 +1305,7 @@ iscsit_check_dataout_hdr(struct iscsi_conn *conn, unsigned char *buf,
 	if (cmd->data_direction != DMA_TO_DEVICE) {
 		pr_err("Command ITT: 0x%08x received DataOUT for a"
 			" NON-WRITE command.\n", cmd->init_task_tag);
-		return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, buf);
+		return iscsit_dump_data_payload(conn, payload_length, 1);
 	}
 	se_cmd = &cmd->se_cmd;
 	iscsit_mod_dataout_timer(cmd);
-- 
2.0.0


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

* [PATCH 3.12 010/170] iscsi-target: Explicily clear login response PDU in exception path
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (8 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 009/170] iscsi-target: Avoid rejecting incorrect ITT for Data-Out Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 011/170] iscsi-target: fix iscsit_del_np deadlock on unload Jiri Slaby
                   ` (160 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 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 683497566d48f86e04d026de1ee658dd74fc1077 upstream.

This patch adds a explicit memset to the login response PDU
exception path in iscsit_tx_login_rsp().

This addresses a regression bug introduced in commit baa4d64b
where the initiator would end up not receiving the login
response and associated status class + detail, before closing
the login connection.

Reported-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr>
Tested-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/target/iscsi/iscsi_target_util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c
index 1039de499bc6..658c9c77ec04 100644
--- a/drivers/target/iscsi/iscsi_target_util.c
+++ b/drivers/target/iscsi/iscsi_target_util.c
@@ -1294,6 +1294,8 @@ int iscsit_tx_login_rsp(struct iscsi_conn *conn, u8 status_class, u8 status_deta
 	login->login_failed = 1;
 	iscsit_collect_login_stats(conn, status_class, status_detail);
 
+	memset(&login->rsp[0], 0, ISCSI_HDR_LEN);
+
 	hdr	= (struct iscsi_login_rsp *)&login->rsp[0];
 	hdr->opcode		= ISCSI_OP_LOGIN_RSP;
 	hdr->status_class	= status_class;
-- 
2.0.0


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

* [PATCH 3.12 011/170] iscsi-target: fix iscsit_del_np deadlock on unload
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (9 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 010/170] iscsi-target: Explicily clear login response PDU in exception path Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 012/170] Input: elantech - deal with clickpads reporting right button events Jiri Slaby
                   ` (159 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Mikulas Patocka, Nicholas Bellinger, Jiri Slaby

From: Mikulas Patocka <mpatocka@redhat.com>

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

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

commit 81a9c5e72bdf7109a65102ca61d8cbd722cf4021 upstream.

On uniprocessor preemptible kernel, target core deadlocks on unload. The
following events happen:
* iscsit_del_np is called
* it calls send_sig(SIGINT, np->np_thread, 1);
* the scheduler switches to the np_thread
* the np_thread is woken up, it sees that kthread_should_stop() returns
  false, so it doesn't terminate
* the np_thread clears signals with flush_signals(current); and goes back
  to sleep in iscsit_accept_np
* the scheduler switches back to iscsit_del_np
* iscsit_del_np calls kthread_stop(np->np_thread);
* the np_thread is waiting in iscsit_accept_np and it doesn't respond to
  kthread_stop

The deadlock could be resolved if the administrator sends SIGINT signal to
the np_thread with killall -INT iscsi_np

The reproducible deadlock was introduced in commit
db6077fd0b7dd41dc6ff18329cec979379071f87, but the thread-stopping code was
racy even before.

This patch fixes the problem. Using kthread_should_stop to stop the
np_thread is unreliable, so we test np_thread_state instead. If
np_thread_state equals ISCSI_NP_THREAD_SHUTDOWN, the thread exits.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/target/iscsi/iscsi_target_login.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
index f140a0eac985..8d44bec42e95 100644
--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -1198,7 +1198,7 @@ old_sess_out:
 static int __iscsi_target_login_thread(struct iscsi_np *np)
 {
 	u8 *buffer, zero_tsih = 0;
-	int ret = 0, rc, stop;
+	int ret = 0, rc;
 	struct iscsi_conn *conn = NULL;
 	struct iscsi_login *login;
 	struct iscsi_portal_group *tpg = NULL;
@@ -1212,6 +1212,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
 	if (np->np_thread_state == ISCSI_NP_THREAD_RESET) {
 		np->np_thread_state = ISCSI_NP_THREAD_ACTIVE;
 		complete(&np->np_restart_comp);
+	} else if (np->np_thread_state == ISCSI_NP_THREAD_SHUTDOWN) {
+		spin_unlock_bh(&np->np_thread_lock);
+		goto exit;
 	} else {
 		np->np_thread_state = ISCSI_NP_THREAD_ACTIVE;
 	}
@@ -1404,10 +1407,8 @@ old_sess_out:
 	}
 
 out:
-	stop = kthread_should_stop();
-	/* Wait for another socket.. */
-	if (!stop)
-		return 1;
+	return 1;
+
 exit:
 	iscsi_stop_login_thread_timer(np);
 	spin_lock_bh(&np->np_thread_lock);
@@ -1424,7 +1425,7 @@ int iscsi_target_login_thread(void *arg)
 
 	allow_signal(SIGINT);
 
-	while (!kthread_should_stop()) {
+	while (1) {
 		ret = __iscsi_target_login_thread(np);
 		/*
 		 * We break and exit here unless another sock_accept() call
-- 
2.0.0


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

* [PATCH 3.12 012/170] Input: elantech - deal with clickpads reporting right button events
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (10 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 011/170] iscsi-target: fix iscsit_del_np deadlock on unload Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 013/170] Input: elantech - don't set bit 1 of reg_10 when the no_hw_res quirk is set Jiri Slaby
                   ` (158 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Hans de Goede, Dmitry Torokhov, Jiri Slaby

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

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

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

commit cd9e83e2754465856097f31c7ab933ce74c473f8 upstream.

At least the Dell Vostro 5470 elantech *clickpad* reports right button
clicks when clicked in the right bottom area:

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

This is different from how (elantech) clickpads normally operate, normally
no matter where the user clicks on the pad the pad always reports a left
button event, since there is only 1 hardware button beneath the path.

It looks like Dell has put 2 buttons under the pad, one under each bottom
corner, causing this.

Since this however still clearly is a real clickpad hardware-wise, we still
want to report it as such to userspace, so that things like finger movement
in the bottom area can be properly ignored as it should be on clickpads.

So deal with this weirdness by simply mapping a right click to a left click
on elantech clickpads. As an added advantage this is something which we can
simply do on all elantech clickpads, so no need to add special quirks for
this weird model.

Reported-and-tested-by: Elder Marco <eldermarco@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/mouse/elantech.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 230cdcf8e6fe..360e46b200de 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -473,8 +473,15 @@ static void elantech_report_absolute_v3(struct psmouse *psmouse,
 	input_report_key(dev, BTN_TOOL_FINGER, fingers == 1);
 	input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2);
 	input_report_key(dev, BTN_TOOL_TRIPLETAP, fingers == 3);
-	input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
-	input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
+
+	/* For clickpads map both buttons to BTN_LEFT */
+	if (etd->fw_version & 0x001000) {
+		input_report_key(dev, BTN_LEFT, packet[0] & 0x03);
+	} else {
+		input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
+		input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
+	}
+
 	input_report_abs(dev, ABS_PRESSURE, pres);
 	input_report_abs(dev, ABS_TOOL_WIDTH, width);
 
@@ -484,10 +491,17 @@ static void elantech_report_absolute_v3(struct psmouse *psmouse,
 static void elantech_input_sync_v4(struct psmouse *psmouse)
 {
 	struct input_dev *dev = psmouse->dev;
+	struct elantech_data *etd = psmouse->private;
 	unsigned char *packet = psmouse->packet;
 
-	input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
-	input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
+	/* For clickpads map both buttons to BTN_LEFT */
+	if (etd->fw_version & 0x001000) {
+		input_report_key(dev, BTN_LEFT, packet[0] & 0x03);
+	} else {
+		input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
+		input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
+	}
+
 	input_mt_report_pointer_emulation(dev, true);
 	input_sync(dev);
 }
-- 
2.0.0


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

* [PATCH 3.12 013/170] Input: elantech - don't set bit 1 of reg_10 when the no_hw_res quirk is set
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (11 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 012/170] Input: elantech - deal with clickpads reporting right button events Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 014/170] PCI: Add new ID for Intel GPU "spurious interrupt" quirk Jiri Slaby
                   ` (157 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Hans de Goede, Dmitry Torokhov, Jiri Slaby

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

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

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

commit fb4f8f568a9def02240ef9bf7aabd246dc63a081 upstream.

The touchpad on the GIGABYTE U2442 not only stops communicating when we try
to set bit 3 (enable real hardware resolution) of reg_10, but on some BIOS
versions also when we set bit 1 (enable two finger mode auto correct).

I've asked the original reporter of:
https://bugzilla.kernel.org/show_bug.cgi?id=61151

To check that not setting bit 1 does not lead to any adverse effects on his
model / BIOS revision, and it does not, so this commit fixes the touchpad
not working on these versions by simply never setting bit 1 for laptop
models with the no_hw_res quirk.

Reported-and-tested-by: James Lademann <jwlademann@gmail.com>
Tested-by: Philipp Wolfer <ph.wolfer@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/mouse/elantech.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 360e46b200de..233516aff595 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -849,7 +849,7 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
 		if (etd->set_hw_resolution)
 			etd->reg_10 = 0x0b;
 		else
-			etd->reg_10 = 0x03;
+			etd->reg_10 = 0x01;
 
 		if (elantech_write_reg(psmouse, 0x10, etd->reg_10))
 			rc = -1;
@@ -1350,7 +1350,8 @@ static int elantech_reconnect(struct psmouse *psmouse)
 }
 
 /*
- * Some hw_version 3 models go into error state when we try to set bit 3 of r10
+ * Some hw_version 3 models go into error state when we try to set
+ * bit 3 and/or bit 1 of r10.
  */
 static const struct dmi_system_id no_hw_res_dmi_table[] = {
 #if defined(CONFIG_DMI) && defined(CONFIG_X86)
-- 
2.0.0


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

* [PATCH 3.12 014/170] PCI: Add new ID for Intel GPU "spurious interrupt" quirk
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (12 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 013/170] Input: elantech - don't set bit 1 of reg_10 when the no_hw_res quirk is set Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 015/170] PCI: Fix incorrect vgaarb conditional in WARN_ON() Jiri Slaby
                   ` (156 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Thomas Jarosch, Bjorn Helgaas, Jiri Slaby

From: Thomas Jarosch <thomas.jarosch@intra2net.com>

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

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

commit 7c82126a94e69bbbac586f0249e7ef11e681246c upstream.

After a CPU upgrade while keeping the same mainboard, we faced "spurious
interrupt" problems again.

It turned out that the new CPU also featured a new GPU with a different PCI
ID.

Add this PCI ID to the quirk table.  Probably all other Intel GPU PCI IDs
are affected, too, but I don't want to add them without a test system.

See f67fd55fa96f ("PCI: Add quirk for still enabled interrupts on Intel
Sandy Bridge GPUs") for some history.

[bhelgaas: add f67fd55fa96f reference, stable tag]
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/pci/quirks.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index f6c31fabf3af..3af18b94d0d3 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2953,6 +2953,7 @@ static void disable_igfx_irq(struct pci_dev *dev)
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0152, disable_igfx_irq);
 
 /*
  * Some devices may pass our check in pci_intx_mask_supported if
-- 
2.0.0


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

* [PATCH 3.12 015/170] PCI: Fix incorrect vgaarb conditional in WARN_ON()
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (13 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 014/170] PCI: Add new ID for Intel GPU "spurious interrupt" quirk Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 016/170] mtip32xx: Fix ERO and NoSnoop values in PCIe upstream on AMD systems Jiri Slaby
                   ` (155 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Bjorn Helgaas, Jiri Slaby

From: Bjorn Helgaas <bhelgaas@google.com>

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

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

commit 67ebd8140dc8923c65451fa0f6a8eee003c4dcd3 upstream.

3448a19da479 "vgaarb: use bridges to control VGA routing where possible"
added the "flags & PCI_VGA_STATE_CHANGE_DECODES" condition to an existing
WARN_ON(), but used bitwise AND (&) instead of logical AND (&&), so the
condition is never true.  Replace with logical AND.

Found by Coverity (CID 142811).

Fixes: 3448a19da479 "vgaarb: use bridges to control VGA routing where possible"
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: David Airlie <airlied@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 9fc3f1f4557b..4108166ffdf4 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4135,7 +4135,7 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode,
 	u16 cmd;
 	int rc;
 
-	WARN_ON((flags & PCI_VGA_STATE_CHANGE_DECODES) & (command_bits & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY)));
+	WARN_ON((flags & PCI_VGA_STATE_CHANGE_DECODES) && (command_bits & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY)));
 
 	/* ARCH specific VGA enables */
 	rc = pci_set_vga_state_arch(dev, decode, command_bits, flags);
-- 
2.0.0


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

* [PATCH 3.12 016/170] mtip32xx: Fix ERO and NoSnoop values in PCIe upstream on AMD systems
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (14 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 015/170] PCI: Fix incorrect vgaarb conditional in WARN_ON() Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 017/170] mtip32xx: Increase timeout for STANDBY IMMEDIATE command Jiri Slaby
                   ` (154 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Asai Thambi S P, Sam Bradshaw, Jens Axboe, Jiri Slaby

From: Asai Thambi S P <asamymuthupa@micron.com>

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

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

commit d1e714db8129a1d3670e449b87719c78e2c76f9f upstream.

A hardware quirk in P320h/P420m interfere with PCIe transactions on some
AMD chipsets, making P320h/P420m unusable. This workaround is to disable
ERO and NoSnoop bits in the parent and root complex for normal
functioning of these devices

NOTE: This workaround is specific to AMD chipset with a PCIe upstream
device with device id 0x5aXX

Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: Sam Bradshaw <sbradshaw@micron.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/block/mtip32xx/mtip32xx.c | 53 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 4d26c25aa9c5..2e98df1a5c93 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -4285,6 +4285,57 @@ static DEFINE_HANDLER(5);
 static DEFINE_HANDLER(6);
 static DEFINE_HANDLER(7);
 
+static void mtip_disable_link_opts(struct driver_data *dd, struct pci_dev *pdev)
+{
+	int pos;
+	unsigned short pcie_dev_ctrl;
+
+	pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
+	if (pos) {
+		pci_read_config_word(pdev,
+			pos + PCI_EXP_DEVCTL,
+			&pcie_dev_ctrl);
+		if (pcie_dev_ctrl & (1 << 11) ||
+		    pcie_dev_ctrl & (1 << 4)) {
+			dev_info(&dd->pdev->dev,
+				"Disabling ERO/No-Snoop on bridge device %04x:%04x\n",
+					pdev->vendor, pdev->device);
+			pcie_dev_ctrl &= ~(PCI_EXP_DEVCTL_NOSNOOP_EN |
+						PCI_EXP_DEVCTL_RELAX_EN);
+			pci_write_config_word(pdev,
+				pos + PCI_EXP_DEVCTL,
+				pcie_dev_ctrl);
+		}
+	}
+}
+
+static void mtip_fix_ero_nosnoop(struct driver_data *dd, struct pci_dev *pdev)
+{
+	/*
+	 * This workaround is specific to AMD/ATI chipset with a PCI upstream
+	 * device with device id 0x5aXX
+	 */
+	if (pdev->bus && pdev->bus->self) {
+		if (pdev->bus->self->vendor == PCI_VENDOR_ID_ATI &&
+		    ((pdev->bus->self->device & 0xff00) == 0x5a00)) {
+			mtip_disable_link_opts(dd, pdev->bus->self);
+		} else {
+			/* Check further up the topology */
+			struct pci_dev *parent_dev = pdev->bus->self;
+			if (parent_dev->bus &&
+				parent_dev->bus->parent &&
+				parent_dev->bus->parent->self &&
+				parent_dev->bus->parent->self->vendor ==
+					 PCI_VENDOR_ID_ATI &&
+				(parent_dev->bus->parent->self->device &
+					0xff00) == 0x5a00) {
+				mtip_disable_link_opts(dd,
+					parent_dev->bus->parent->self);
+			}
+		}
+	}
+}
+
 /*
  * Called for each supported PCI device detected.
  *
@@ -4436,6 +4487,8 @@ static int mtip_pci_probe(struct pci_dev *pdev,
 		goto block_initialize_err;
 	}
 
+	mtip_fix_ero_nosnoop(dd, pdev);
+
 	/* Initialize the block layer. */
 	rv = mtip_block_initialize(dd);
 	if (rv < 0) {
-- 
2.0.0


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

* [PATCH 3.12 017/170] mtip32xx: Increase timeout for STANDBY IMMEDIATE command
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (15 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 016/170] mtip32xx: Fix ERO and NoSnoop values in PCIe upstream on AMD systems Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 018/170] mtip32xx: Remove dfs_parent after pci unregister Jiri Slaby
                   ` (153 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Asai Thambi S P, Selvan Mani, Jens Axboe, Jiri Slaby

From: Asai Thambi S P <asamymuthupa@micron.com>

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

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

commit 670a641420a3d9586eebe7429dfeec4e7ed447aa upstream.

Increased timeout for STANDBY IMMEDIATE command to 2 minutes.

Signed-off-by: Selvan Mani <smani@micron.com>
Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/block/mtip32xx/mtip32xx.c | 66 +++++++++++++++++++++------------------
 1 file changed, 35 insertions(+), 31 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 2e98df1a5c93..6fc6beb86493 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -1493,6 +1493,37 @@ static inline void ata_swap_string(u16 *buf, unsigned int len)
 		be16_to_cpus(&buf[i]);
 }
 
+static void mtip_set_timeout(struct driver_data *dd,
+					struct host_to_dev_fis *fis,
+					unsigned int *timeout, u8 erasemode)
+{
+	switch (fis->command) {
+	case ATA_CMD_DOWNLOAD_MICRO:
+		*timeout = 120000; /* 2 minutes */
+		break;
+	case ATA_CMD_SEC_ERASE_UNIT:
+	case 0xFC:
+		if (erasemode)
+			*timeout = ((*(dd->port->identify + 90) * 2) * 60000);
+		else
+			*timeout = ((*(dd->port->identify + 89) * 2) * 60000);
+		break;
+	case ATA_CMD_STANDBYNOW1:
+		*timeout = 120000;  /* 2 minutes */
+		break;
+	case 0xF7:
+	case 0xFA:
+		*timeout = 60000;  /* 60 seconds */
+		break;
+	case ATA_CMD_SMART:
+		*timeout = 15000;  /* 15 seconds */
+		break;
+	default:
+		*timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS;
+		break;
+	}
+}
+
 /*
  * Request the device identity information.
  *
@@ -1602,6 +1633,7 @@ static int mtip_standby_immediate(struct mtip_port *port)
 	int rv;
 	struct host_to_dev_fis	fis;
 	unsigned long start;
+	unsigned int timeout;
 
 	/* Build the FIS. */
 	memset(&fis, 0, sizeof(struct host_to_dev_fis));
@@ -1609,6 +1641,8 @@ static int mtip_standby_immediate(struct mtip_port *port)
 	fis.opts	= 1 << 7;
 	fis.command	= ATA_CMD_STANDBYNOW1;
 
+	mtip_set_timeout(port->dd, &fis, &timeout, 0);
+
 	start = jiffies;
 	rv = mtip_exec_internal_command(port,
 					&fis,
@@ -1617,7 +1651,7 @@ static int mtip_standby_immediate(struct mtip_port *port)
 					0,
 					0,
 					GFP_ATOMIC,
-					15000);
+					timeout);
 	dbg_printk(MTIP_DRV_NAME "Time taken to complete standby cmd: %d ms\n",
 			jiffies_to_msecs(jiffies - start));
 	if (rv)
@@ -2156,36 +2190,6 @@ static unsigned int implicit_sector(unsigned char command,
 	}
 	return rv;
 }
-static void mtip_set_timeout(struct driver_data *dd,
-					struct host_to_dev_fis *fis,
-					unsigned int *timeout, u8 erasemode)
-{
-	switch (fis->command) {
-	case ATA_CMD_DOWNLOAD_MICRO:
-		*timeout = 120000; /* 2 minutes */
-		break;
-	case ATA_CMD_SEC_ERASE_UNIT:
-	case 0xFC:
-		if (erasemode)
-			*timeout = ((*(dd->port->identify + 90) * 2) * 60000);
-		else
-			*timeout = ((*(dd->port->identify + 89) * 2) * 60000);
-		break;
-	case ATA_CMD_STANDBYNOW1:
-		*timeout = 120000;  /* 2 minutes */
-		break;
-	case 0xF7:
-	case 0xFA:
-		*timeout = 60000;  /* 60 seconds */
-		break;
-	case ATA_CMD_SMART:
-		*timeout = 15000;  /* 15 seconds */
-		break;
-	default:
-		*timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS;
-		break;
-	}
-}
 
 /*
  * Executes a taskfile
-- 
2.0.0


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

* [PATCH 3.12 018/170] mtip32xx: Remove dfs_parent after pci unregister
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (16 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 017/170] mtip32xx: Increase timeout for STANDBY IMMEDIATE command Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 019/170] recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modules Jiri Slaby
                   ` (152 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Asai Thambi S P, Jens Axboe, Jiri Slaby

From: Asai Thambi S P <asamymuthupa@micron.com>

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

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

commit af5ded8ccf21627f9614afc03b356712666ed225 upstream.

In module exit, dfs_parent and it's subtree were removed before
unregistering with pci. When debugfs entry for each device is attempted
to remove in pci_remove() context, they don't exist, as dfs_parent and
its children were already ripped apart.

Modified to first unregister with pci and then remove dfs_parent.

Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/block/mtip32xx/mtip32xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 6fc6beb86493..560227b817fe 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -4785,13 +4785,13 @@ static int __init mtip_init(void)
  */
 static void __exit mtip_exit(void)
 {
-	debugfs_remove_recursive(dfs_parent);
-
 	/* Release the allocated major block device number. */
 	unregister_blkdev(mtip_major, MTIP_DRV_NAME);
 
 	/* Unregister the PCI driver. */
 	pci_unregister_driver(&mtip_pci_driver);
+
+	debugfs_remove_recursive(dfs_parent);
 }
 
 MODULE_AUTHOR("Micron Technology, Inc");
-- 
2.0.0


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

* [PATCH 3.12 019/170] recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modules
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (17 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 018/170] mtip32xx: Remove dfs_parent after pci unregister Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 020/170] MIPS: MSC: Prevent out-of-bounds writes to MIPS SC ioremap'd region Jiri Slaby
                   ` (151 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alex Smith, linux-mips, Ralf Baechle, Jiri Slaby

From: Alex Smith <alex.smith@imgtec.com>

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

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

commit 91ad11d7cc6f4472ebf177a6252fbf0fd100d798 upstream.

On MIPS calls to _mcount in modules generate 2 instructions to load
the _mcount address (and therefore 2 relocations). The mcount_loc
table should only reference the first of these, so the second is
filtered out by checking the relocation offset and ignoring ones that
immediately follow the previous one seen.

However if a module has an _mcount call at offset 0, the second
relocation would not be filtered out due to old_r_offset == 0
being taken to mean that the current relocation is the first one
seen, and both would end up in the mcount_loc table.

This results in ftrace_make_nop() patching both (adjacent)
instructions to branches over the _mcount call sequence like so:

  0xffffffffc08a8000:  04 00 00 10     b       0xffffffffc08a8014
  0xffffffffc08a8004:  04 00 00 10     b       0xffffffffc08a8018
  0xffffffffc08a8008:  2d 08 e0 03     move    at,ra
  ...

The second branch is in the delay slot of the first, which is
defined to be unpredictable - on the platform on which this bug was
encountered, it triggers a reserved instruction exception.

Fix by initializing old_r_offset to ~0 and using that instead of 0
to determine whether the current relocation is the first seen.

Signed-off-by: Alex Smith <alex.smith@imgtec.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7098/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 scripts/recordmcount.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index 9d1421e63ff8..49b582a225b0 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -163,11 +163,11 @@ static int mcount_adjust = 0;
 
 static int MIPS_is_fake_mcount(Elf_Rel const *rp)
 {
-	static Elf_Addr old_r_offset;
+	static Elf_Addr old_r_offset = ~(Elf_Addr)0;
 	Elf_Addr current_r_offset = _w(rp->r_offset);
 	int is_fake;
 
-	is_fake = old_r_offset &&
+	is_fake = (old_r_offset != ~(Elf_Addr)0) &&
 		(current_r_offset - old_r_offset == MIPS_FAKEMCOUNT_OFFSET);
 	old_r_offset = current_r_offset;
 
-- 
2.0.0


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

* [PATCH 3.12 020/170] MIPS: MSC: Prevent out-of-bounds writes to MIPS SC ioremap'd region
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (18 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 019/170] recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modules Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 021/170] UBIFS: fix an mmap and fsync race condition Jiri Slaby
                   ` (150 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Markos Chandras, linux-mips, Ralf Baechle, Jiri Slaby

From: Markos Chandras <markos.chandras@imgtec.com>

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

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

commit ab6c15bc6620ebe220970cc040b29bcb2757f373 upstream.

Previously, the lower limit for the MIPS SC initialization loop was
set incorrectly allowing one extra loop leading to writes
beyond the MSC ioremap'd space. More precisely, the value of the 'imp'
in the last loop increased beyond the msc_irqmap_t boundaries and
as a result of which, the 'n' variable was loaded with an incorrect
value. This value was used later on to calculate the offset in the
MSC01_IC_SUP which led to random crashes like the following one:

CPU 0 Unable to handle kernel paging request at virtual address e75c0200,
epc == 8058dba4, ra == 8058db90
[...]
Call Trace:
[<8058dba4>] init_msc_irqs+0x104/0x154
[<8058b5bc>] arch_init_irq+0xd8/0x154
[<805897b0>] start_kernel+0x220/0x36c

Kernel panic - not syncing: Attempted to kill the idle task!

This patch fixes the problem

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7118/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/mips/kernel/irq-msc01.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/kernel/irq-msc01.c b/arch/mips/kernel/irq-msc01.c
index fab40f7d2e03..ac9facc08694 100644
--- a/arch/mips/kernel/irq-msc01.c
+++ b/arch/mips/kernel/irq-msc01.c
@@ -131,7 +131,7 @@ void __init init_msc_irqs(unsigned long icubase, unsigned int irqbase, msc_irqma
 
 	board_bind_eic_interrupt = &msc_bind_eic_interrupt;
 
-	for (; nirq >= 0; nirq--, imp++) {
+	for (; nirq > 0; nirq--, imp++) {
 		int n = imp->im_irq;
 
 		switch (imp->im_type) {
-- 
2.0.0


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

* [PATCH 3.12 021/170] UBIFS: fix an mmap and fsync race condition
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (19 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 020/170] MIPS: MSC: Prevent out-of-bounds writes to MIPS SC ioremap'd region Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 022/170] UBIFS: Remove incorrect assertion in shrink_tnc() Jiri Slaby
                   ` (149 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, hujianyang, Artem Bityutskiy, Jiri Slaby

From: hujianyang <hujianyang@huawei.com>

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

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

commit 691a7c6f28ac90cccd0dbcf81348ea90b211bdd0 upstream.

There is a race condition in UBIFS:

Thread A (mmap)                        Thread B (fsync)

->__do_fault                           ->write_cache_pages
   -> ubifs_vm_page_mkwrite
       -> budget_space
       -> lock_page
       -> release/convert_page_budget
       -> SetPagePrivate
       -> TestSetPageDirty
       -> unlock_page
                                       -> lock_page
                                           -> TestClearPageDirty
                                           -> ubifs_writepage
                                               -> do_writepage
                                                   -> release_budget
                                                   -> ClearPagePrivate
                                                   -> unlock_page
   -> !(ret & VM_FAULT_LOCKED)
   -> lock_page
   -> set_page_dirty
       -> ubifs_set_page_dirty
           -> TestSetPageDirty (set page dirty without budgeting)
   -> unlock_page

This leads to situation where we have a diry page but no budget allocated for
this page, so further write-back may fail with -ENOSPC.

In this fix we return from page_mkwrite without performing unlock_page. We
return VM_FAULT_LOCKED instead. After doing this, the race above will not
happen.

Signed-off-by: hujianyang <hujianyang@huawei.com>
Tested-by: Laurence Withers <lwithers@guralp.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/ubifs/file.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 123c79b7261e..b56eb6275744 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1525,8 +1525,7 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma,
 	}
 
 	wait_for_stable_page(page);
-	unlock_page(page);
-	return 0;
+	return VM_FAULT_LOCKED;
 
 out_unlock:
 	unlock_page(page);
-- 
2.0.0


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

* [PATCH 3.12 022/170] UBIFS: Remove incorrect assertion in shrink_tnc()
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (20 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 021/170] UBIFS: fix an mmap and fsync race condition Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 023/170] watchdog: sp805: Set watchdog_device->timeout from ->set_timeout() Jiri Slaby
                   ` (148 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, hujianyang, Artem Bityutskiy, Jiri Slaby

From: hujianyang <hujianyang@huawei.com>

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

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

commit 72abc8f4b4e8574318189886de627a2bfe6cd0da upstream.

I hit the same assert failed as Dolev Raviv reported in Kernel v3.10
shows like this:

[ 9641.164028] UBIFS assert failed in shrink_tnc at 131 (pid 13297)
[ 9641.234078] CPU: 1 PID: 13297 Comm: mmap.test Tainted: G           O 3.10.40 #1
[ 9641.234116] [<c0011a6c>] (unwind_backtrace+0x0/0x12c) from [<c000d0b0>] (show_stack+0x20/0x24)
[ 9641.234137] [<c000d0b0>] (show_stack+0x20/0x24) from [<c0311134>] (dump_stack+0x20/0x28)
[ 9641.234188] [<c0311134>] (dump_stack+0x20/0x28) from [<bf22425c>] (shrink_tnc_trees+0x25c/0x350 [ubifs])
[ 9641.234265] [<bf22425c>] (shrink_tnc_trees+0x25c/0x350 [ubifs]) from [<bf2245ac>] (ubifs_shrinker+0x25c/0x310 [ubifs])
[ 9641.234307] [<bf2245ac>] (ubifs_shrinker+0x25c/0x310 [ubifs]) from [<c00cdad8>] (shrink_slab+0x1d4/0x2f8)
[ 9641.234327] [<c00cdad8>] (shrink_slab+0x1d4/0x2f8) from [<c00d03d0>] (do_try_to_free_pages+0x300/0x544)
[ 9641.234344] [<c00d03d0>] (do_try_to_free_pages+0x300/0x544) from [<c00d0a44>] (try_to_free_pages+0x2d0/0x398)
[ 9641.234363] [<c00d0a44>] (try_to_free_pages+0x2d0/0x398) from [<c00c6a60>] (__alloc_pages_nodemask+0x494/0x7e8)
[ 9641.234382] [<c00c6a60>] (__alloc_pages_nodemask+0x494/0x7e8) from [<c00f62d8>] (new_slab+0x78/0x238)
[ 9641.234400] [<c00f62d8>] (new_slab+0x78/0x238) from [<c031081c>] (__slab_alloc.constprop.42+0x1a4/0x50c)
[ 9641.234419] [<c031081c>] (__slab_alloc.constprop.42+0x1a4/0x50c) from [<c00f80e8>] (kmem_cache_alloc_trace+0x54/0x188)
[ 9641.234459] [<c00f80e8>] (kmem_cache_alloc_trace+0x54/0x188) from [<bf227908>] (do_readpage+0x168/0x468 [ubifs])
[ 9641.234553] [<bf227908>] (do_readpage+0x168/0x468 [ubifs]) from [<bf2296a0>] (ubifs_readpage+0x424/0x464 [ubifs])
[ 9641.234606] [<bf2296a0>] (ubifs_readpage+0x424/0x464 [ubifs]) from [<c00c17c0>] (filemap_fault+0x304/0x418)
[ 9641.234638] [<c00c17c0>] (filemap_fault+0x304/0x418) from [<c00de694>] (__do_fault+0xd4/0x530)
[ 9641.234665] [<c00de694>] (__do_fault+0xd4/0x530) from [<c00e10c0>] (handle_pte_fault+0x480/0xf54)
[ 9641.234690] [<c00e10c0>] (handle_pte_fault+0x480/0xf54) from [<c00e2bf8>] (handle_mm_fault+0x140/0x184)
[ 9641.234716] [<c00e2bf8>] (handle_mm_fault+0x140/0x184) from [<c0316688>] (do_page_fault+0x150/0x3ac)
[ 9641.234737] [<c0316688>] (do_page_fault+0x150/0x3ac) from [<c000842c>] (do_DataAbort+0x3c/0xa0)
[ 9641.234759] [<c000842c>] (do_DataAbort+0x3c/0xa0) from [<c0314e38>] (__dabt_usr+0x38/0x40)

After analyzing the code, I found a condition that may cause this failed
in correct operations. Thus, I think this assertion is wrong and should be
removed.

Suppose there are two clean znodes and one dirty znode in TNC. So the
per-filesystem atomic_t @clean_zn_cnt is (2). If commit start, dirty_znode
is set to COW_ZNODE in get_znodes_to_commit() in case of potentially ops
on this znode. We clear COW bit and DIRTY bit in write_index() without
@tnc_mutex locked. We don't increase @clean_zn_cnt in this place. As the
comments in write_index() shows, if another process hold @tnc_mutex and
dirty this znode after we clean it, @clean_zn_cnt would be decreased to (1).
We will increase @clean_zn_cnt to (2) with @tnc_mutex locked in
free_obsolete_znodes() to keep it right.

If shrink_tnc() performs between decrease and increase, it will release
other 2 clean znodes it holds and found @clean_zn_cnt is less than zero
(1 - 2 = -1), then hit the assertion. Because free_obsolete_znodes() will
soon correct @clean_zn_cnt and no harm to fs in this case, I think this
assertion could be removed.

2 clean zondes and 1 dirty znode, @clean_zn_cnt == 2

Thread A (commit)         Thread B (write or others)       Thread C (shrinker)
->write_index
   ->clear_bit(DIRTY_NODE)
   ->clear_bit(COW_ZNODE)

            @clean_zn_cnt == 2
                          ->mutex_locked(&tnc_mutex)
                          ->dirty_cow_znode
                              ->!ubifs_zn_cow(znode)
                              ->!test_and_set_bit(DIRTY_NODE)
                              ->atomic_dec(&clean_zn_cnt)
                          ->mutex_unlocked(&tnc_mutex)

            @clean_zn_cnt == 1
                                                           ->mutex_locked(&tnc_mutex)
                                                           ->shrink_tnc
                                                             ->destroy_tnc_subtree
                                                             ->atomic_sub(&clean_zn_cnt, 2)
                                                             ->ubifs_assert  <- hit
                                                           ->mutex_unlocked(&tnc_mutex)

            @clean_zn_cnt == -1
->mutex_lock(&tnc_mutex)
->free_obsolete_znodes
   ->atomic_inc(&clean_zn_cnt)
->mutux_unlock(&tnc_mutex)

            @clean_zn_cnt == 0 (correct after shrink)

Signed-off-by: hujianyang <hujianyang@huawei.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/ubifs/shrinker.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/ubifs/shrinker.c b/fs/ubifs/shrinker.c
index f35135e28e96..9a9fb94a41c6 100644
--- a/fs/ubifs/shrinker.c
+++ b/fs/ubifs/shrinker.c
@@ -128,7 +128,6 @@ static int shrink_tnc(struct ubifs_info *c, int nr, int age, int *contention)
 			freed = ubifs_destroy_tnc_subtree(znode);
 			atomic_long_sub(freed, &ubifs_clean_zn_cnt);
 			atomic_long_sub(freed, &c->clean_zn_cnt);
-			ubifs_assert(atomic_long_read(&c->clean_zn_cnt) >= 0);
 			total_freed += freed;
 			znode = zprev;
 		}
-- 
2.0.0


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

* [PATCH 3.12 023/170] watchdog: sp805: Set watchdog_device->timeout from ->set_timeout()
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (21 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 022/170] UBIFS: Remove incorrect assertion in shrink_tnc() Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 024/170] watchdog: ath79_wdt: avoid spurious restarts on AR934x Jiri Slaby
                   ` (147 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Viresh Kumar, Wim Van Sebroeck, Jiri Slaby

From: Viresh Kumar <viresh.kumar@linaro.org>

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

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

commit 938626d96a3ffb9eb54552bb0d3a4f2b30ffdeb0 upstream.

Implementation of ->set_timeout() is supposed to set 'timeout' field of 'struct
watchdog_device' passed to it. sp805 was rather setting this in a local
variable. Fix it.

Reported-by: Arun Ramamurthy <arun.ramamurthy@broadcom.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/watchdog/sp805_wdt.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
index 58df98aec122..2cf02ffbf9d8 100644
--- a/drivers/watchdog/sp805_wdt.c
+++ b/drivers/watchdog/sp805_wdt.c
@@ -60,7 +60,6 @@
  * @adev: amba device structure of wdt
  * @status: current status of wdt
  * @load_val: load value to be set for current timeout
- * @timeout: current programmed timeout
  */
 struct sp805_wdt {
 	struct watchdog_device		wdd;
@@ -69,7 +68,6 @@ struct sp805_wdt {
 	struct clk			*clk;
 	struct amba_device		*adev;
 	unsigned int			load_val;
-	unsigned int			timeout;
 };
 
 static bool nowayout = WATCHDOG_NOWAYOUT;
@@ -99,7 +97,7 @@ static int wdt_setload(struct watchdog_device *wdd, unsigned int timeout)
 	spin_lock(&wdt->lock);
 	wdt->load_val = load;
 	/* roundup timeout to closest positive integer value */
-	wdt->timeout = div_u64((load + 1) * 2 + (rate / 2), rate);
+	wdd->timeout = div_u64((load + 1) * 2 + (rate / 2), rate);
 	spin_unlock(&wdt->lock);
 
 	return 0;
-- 
2.0.0


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

* [PATCH 3.12 024/170] watchdog: ath79_wdt: avoid spurious restarts on AR934x
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (22 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 023/170] watchdog: sp805: Set watchdog_device->timeout from ->set_timeout() Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 025/170] watchdog: kempld-wdt: Use the correct value when configuring the prescaler with the watchdog Jiri Slaby
                   ` (146 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Gabor Juhos, Wim Van Sebroeck, Jiri Slaby

From: Gabor Juhos <juhosg@openwrt.org>

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

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

commit 23afeb613ec0e10aecfae7838a14d485db62ac52 upstream.

On some AR934x based systems, where the frequency of
the AHB bus is relatively high, the built-in watchdog
causes a spurious restart when it gets enabled.

The possible cause of these restarts is that the timeout
value written into the TIMER register does not reaches
the hardware in time.

Add an explicit delay into the ath79_wdt_enable function
to avoid the spurious restarts.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/watchdog/ath79_wdt.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/watchdog/ath79_wdt.c b/drivers/watchdog/ath79_wdt.c
index 37cb09b27b63..c97a47ca8971 100644
--- a/drivers/watchdog/ath79_wdt.c
+++ b/drivers/watchdog/ath79_wdt.c
@@ -20,6 +20,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/fs.h>
 #include <linux/init.h>
@@ -91,6 +92,15 @@ static inline void ath79_wdt_keepalive(void)
 static inline void ath79_wdt_enable(void)
 {
 	ath79_wdt_keepalive();
+
+	/*
+	 * Updating the TIMER register requires a few microseconds
+	 * on the AR934x SoCs at least. Use a small delay to ensure
+	 * that the TIMER register is updated within the hardware
+	 * before enabling the watchdog.
+	 */
+	udelay(2);
+
 	ath79_wdt_wr(WDOG_REG_CTRL, WDOG_CTRL_ACTION_FCR);
 	/* flush write */
 	ath79_wdt_rr(WDOG_REG_CTRL);
-- 
2.0.0


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

* [PATCH 3.12 025/170] watchdog: kempld-wdt: Use the correct value when configuring the prescaler with the watchdog
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (23 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 024/170] watchdog: ath79_wdt: avoid spurious restarts on AR934x Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 026/170] IB/mlx5: add missing padding at end of struct mlx5_ib_create_cq Jiri Slaby
                   ` (145 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, gundberg, Wim Van Sebroeck, Jiri Slaby

From: gundberg <per.gundberg@icomera.com>

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

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

commit a9e0436b303e94ba57d3bd4b1fcbeaa744b7ebeb upstream.

Use the prescaler index, rather than its value, to configure the watchdog.
This will prevent a mismatch with the prescaler used to calculate the cycles.

Signed-off-by: Per Gundberg <per.gundberg@icomera.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Michael Brunner <michael.brunner@kontron.com>
Tested-by: Michael Brunner <michael.brunner@kontron.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/watchdog/kempld_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/kempld_wdt.c b/drivers/watchdog/kempld_wdt.c
index 5c3d4df63e68..22b9a036b3e1 100644
--- a/drivers/watchdog/kempld_wdt.c
+++ b/drivers/watchdog/kempld_wdt.c
@@ -163,7 +163,7 @@ static int kempld_wdt_set_stage_timeout(struct kempld_wdt_data *wdt_data,
 	kempld_get_mutex(pld);
 	stage_cfg = kempld_read8(pld, KEMPLD_WDT_STAGE_CFG(stage->id));
 	stage_cfg &= ~STAGE_CFG_PRESCALER_MASK;
-	stage_cfg |= STAGE_CFG_SET_PRESCALER(prescaler);
+	stage_cfg |= STAGE_CFG_SET_PRESCALER(PRESCALER_21);
 	kempld_write8(pld, KEMPLD_WDT_STAGE_CFG(stage->id), stage_cfg);
 	kempld_write32(pld, KEMPLD_WDT_STAGE_TIMEOUT(stage->id),
 			stage_timeout);
-- 
2.0.0


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

* [PATCH 3.12 026/170] IB/mlx5: add missing padding at end of struct mlx5_ib_create_cq
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (24 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 025/170] watchdog: kempld-wdt: Use the correct value when configuring the prescaler with the watchdog Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 027/170] IB/mlx5: add missing padding at end of struct mlx5_ib_create_srq Jiri Slaby
                   ` (144 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Yann Droneaud, Roland Dreier, Jiri Slaby

From: Yann Droneaud <ydroneaud@opteya.com>

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

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

commit a8237b32a3faab155a5dc8f886452147ce73da3e upstream.

The i386 ABI disagrees with most other ABIs regarding alignment of
data type larger than 4 bytes: on most ABIs a padding must be added at
end of the structures, while it is not required on i386.

So for most ABI struct mlx5_ib_create_cq get padded to be aligned on a
8 bytes multiple, while for i386, such padding is not added.

The tool pahole can be used to find such implicit padding:

  $ pahole --anon_include \
  	 --nested_anon_include \
  	 --recursive \
  	 --class_name mlx5_ib_create_cq \
  	 drivers/infiniband/hw/mlx5/mlx5_ib.o

Then, structure layout can be compared between i386 and x86_64:

#  +++ obj-i386/drivers/infiniband/hw/mlx5/mlx5_ib.o.pahole.txt    2014-03-28 11:43:07.386413682 +0100
#  --- obj-x86_64/drivers/infiniband/hw/mlx5/mlx5_ib.o.pahole.txt  2014-03-27 13:06:17.788472721 +0100
#  @@ -34,9 +34,8 @@ struct mlx5_ib_create_cq {
#          __u64                      db_addr;              /*     8     8 */
#          __u32                      cqe_size;             /*    16     4 */
#
#  -       /* size: 20, cachelines: 1, members: 3 */
#  -       /* last cacheline: 20 bytes */
#  +       /* size: 24, cachelines: 1, members: 3 */
#  +       /* padding: 4 */
#  +       /* last cacheline: 24 bytes */
#   };

This ABI disagreement will make an x86_64 kernel try to read past the
buffer provided by an i386 binary.

When boundary check will be implemented, a x86_64 kernel will refuse
to read past the i386 userspace provided buffer and the uverb will
fail.

Anyway, if the structure lies in memory on a page boundary and next
page is not mapped, ib_copy_from_udata() will fail when trying to read
the 4 bytes of padding and the uverb will fail.

This patch makes create_cq_user() takes care of the input data size to
handle the case where no padding is provided.

This way, x86_64 kernel will be able to handle struct
mlx5_ib_create_cq as sent by unpatched and patched i386 libmlx5.

Link: http://marc.info/?i=cover.1399309513.git.ydroneaud@opteya.com
Fixes: e126ba97dba9e ("mlx5: Add driver for Mellanox Connect-IB adapter")
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/infiniband/hw/mlx5/cq.c   | 13 ++++++++++++-
 drivers/infiniband/hw/mlx5/user.h |  1 +
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c
index 344ab03948a3..706833ab7e7e 100644
--- a/drivers/infiniband/hw/mlx5/cq.c
+++ b/drivers/infiniband/hw/mlx5/cq.c
@@ -32,6 +32,7 @@
 
 #include <linux/kref.h>
 #include <rdma/ib_umem.h>
+#include <rdma/ib_user_verbs.h>
 #include "mlx5_ib.h"
 #include "user.h"
 
@@ -518,14 +519,24 @@ static int create_cq_user(struct mlx5_ib_dev *dev, struct ib_udata *udata,
 			  int *cqe_size, int *index, int *inlen)
 {
 	struct mlx5_ib_create_cq ucmd;
+	size_t ucmdlen;
 	int page_shift;
 	int npages;
 	int ncont;
 	int err;
 
-	if (ib_copy_from_udata(&ucmd, udata, sizeof(ucmd)))
+	ucmdlen =
+		(udata->inlen - sizeof(struct ib_uverbs_cmd_hdr) <
+		 sizeof(ucmd)) ? (sizeof(ucmd) -
+				  sizeof(ucmd.reserved)) : sizeof(ucmd);
+
+	if (ib_copy_from_udata(&ucmd, udata, ucmdlen))
 		return -EFAULT;
 
+	if (ucmdlen == sizeof(ucmd) &&
+	    ucmd.reserved != 0)
+		return -EINVAL;
+
 	if (ucmd.cqe_size != 64 && ucmd.cqe_size != 128)
 		return -EINVAL;
 
diff --git a/drivers/infiniband/hw/mlx5/user.h b/drivers/infiniband/hw/mlx5/user.h
index a886de3e593c..e7da977e2548 100644
--- a/drivers/infiniband/hw/mlx5/user.h
+++ b/drivers/infiniband/hw/mlx5/user.h
@@ -84,6 +84,7 @@ struct mlx5_ib_create_cq {
 	__u64	buf_addr;
 	__u64	db_addr;
 	__u32	cqe_size;
+	__u32	reserved; /* explicit padding (optional on i386) */
 };
 
 struct mlx5_ib_create_cq_resp {
-- 
2.0.0


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

* [PATCH 3.12 027/170] IB/mlx5: add missing padding at end of struct mlx5_ib_create_srq
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (25 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 026/170] IB/mlx5: add missing padding at end of struct mlx5_ib_create_cq Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 028/170] IB/qib: Fix port in pkey change event Jiri Slaby
                   ` (143 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Yann Droneaud, Roland Dreier, Jiri Slaby

From: Yann Droneaud <ydroneaud@opteya.com>

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

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

commit 43bc889380c2ad9aa230eccc03a15cc52cf710d4 upstream.

The i386 ABI disagrees with most other ABIs regarding alignment of
data type larger than 4 bytes: on most ABIs a padding must be added at
end of the structures, while it is not required on i386.

So for most ABIs struct mlx5_ib_create_srq gets implicitly padded to be
aligned on a 8 bytes multiple, while for i386, such padding is not
added.

Tool pahole could be used to find such implicit padding:

  $ pahole --anon_include \
           --nested_anon_include \
           --recursive \
           --class_name mlx5_ib_create_srq \
           drivers/infiniband/hw/mlx5/mlx5_ib.o

Then, structure layout can be compared between i386 and x86_64:

#  +++ obj-i386/drivers/infiniband/hw/mlx5/mlx5_ib.o.pahole.txt    2014-03-28 11:43:07.386413682 +0100
#  --- obj-x86_64/drivers/infiniband/hw/mlx5/mlx5_ib.o.pahole.txt  2014-03-27 13:06:17.788472721 +0100
#  @@ -69,7 +68,6 @@ struct mlx5_ib_create_srq {
#          __u64                      db_addr;              /*     8     8 */
#          __u32                      flags;                /*    16     4 */
#
#  -       /* size: 20, cachelines: 1, members: 3 */
#  -       /* last cacheline: 20 bytes */
#  +       /* size: 24, cachelines: 1, members: 3 */
#  +       /* padding: 4 */
#  +       /* last cacheline: 24 bytes */
#   };

ABI disagreement will make an x86_64 kernel try to read past
the buffer provided by an i386 binary.

When boundary check will be implemented, the x86_64 kernel will
refuse to read past the i386 userspace provided buffer and the
uverb will fail.

Anyway, if the structure lay in memory on a page boundary and
next page is not mapped, ib_copy_from_udata() will fail and the
uverb will fail.

This patch makes create_srq_user() takes care of the input
data size to handle the case where no padding was provided.

This way, x86_64 kernel will be able to handle struct mlx5_ib_create_srq
as sent by unpatched and patched i386 libmlx5.

Link: http://marc.info/?i=cover.1399309513.git.ydroneaud@opteya.com
Fixes: e126ba97dba9e ("mlx5: Add driver for Mellanox Connect-IB adapter")
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/infiniband/hw/mlx5/srq.c  | 14 +++++++++++++-
 drivers/infiniband/hw/mlx5/user.h |  1 +
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/srq.c b/drivers/infiniband/hw/mlx5/srq.c
index 0aa478bc291a..47a1f0a9c926 100644
--- a/drivers/infiniband/hw/mlx5/srq.c
+++ b/drivers/infiniband/hw/mlx5/srq.c
@@ -35,6 +35,7 @@
 #include <linux/mlx5/srq.h>
 #include <linux/slab.h>
 #include <rdma/ib_umem.h>
+#include <rdma/ib_user_verbs.h>
 
 #include "mlx5_ib.h"
 #include "user.h"
@@ -78,16 +79,27 @@ static int create_srq_user(struct ib_pd *pd, struct mlx5_ib_srq *srq,
 {
 	struct mlx5_ib_dev *dev = to_mdev(pd->device);
 	struct mlx5_ib_create_srq ucmd;
+	size_t ucmdlen;
 	int err;
 	int npages;
 	int page_shift;
 	int ncont;
 	u32 offset;
 
-	if (ib_copy_from_udata(&ucmd, udata, sizeof(ucmd))) {
+	ucmdlen =
+		(udata->inlen - sizeof(struct ib_uverbs_cmd_hdr) <
+		 sizeof(ucmd)) ? (sizeof(ucmd) -
+				  sizeof(ucmd.reserved)) : sizeof(ucmd);
+
+	if (ib_copy_from_udata(&ucmd, udata, ucmdlen)) {
 		mlx5_ib_dbg(dev, "failed copy udata\n");
 		return -EFAULT;
 	}
+
+	if (ucmdlen == sizeof(ucmd) &&
+	    ucmd.reserved != 0)
+		return -EINVAL;
+
 	srq->wq_sig = !!(ucmd.flags & MLX5_SRQ_FLAG_SIGNATURE);
 
 	srq->umem = ib_umem_get(pd->uobject->context, ucmd.buf_addr, buf_size,
diff --git a/drivers/infiniband/hw/mlx5/user.h b/drivers/infiniband/hw/mlx5/user.h
index e7da977e2548..84fea5d00cd2 100644
--- a/drivers/infiniband/hw/mlx5/user.h
+++ b/drivers/infiniband/hw/mlx5/user.h
@@ -100,6 +100,7 @@ struct mlx5_ib_create_srq {
 	__u64	buf_addr;
 	__u64	db_addr;
 	__u32	flags;
+	__u32	reserved; /* explicit padding (optional on i386) */
 };
 
 struct mlx5_ib_create_srq_resp {
-- 
2.0.0


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

* [PATCH 3.12 028/170] IB/qib: Fix port in pkey change event
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (26 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 027/170] IB/mlx5: add missing padding at end of struct mlx5_ib_create_srq Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 029/170] IB/ipath: Translate legacy diagpkt into newer extended diagpkt Jiri Slaby
                   ` (142 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Mike Marciniszyn, Roland Dreier, Jiri Slaby

From: Mike Marciniszyn <mike.marciniszyn@intel.com>

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

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

commit 911eccd284d13d78c92ec4f1f1092c03457d732a upstream.

The code used a literal 1 in dispatching an IB_EVENT_PKEY_CHANGE.

As of the dual port qib QDR card, this is not necessarily correct.

Change to use the port as specified in the call.

Reported-by: Alex Estrin <alex.estrin@intel.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@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_mad.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c
index ccb119143d20..1dd9fcbb7c9a 100644
--- a/drivers/infiniband/hw/qib/qib_mad.c
+++ b/drivers/infiniband/hw/qib/qib_mad.c
@@ -1028,7 +1028,7 @@ static int set_pkeys(struct qib_devdata *dd, u8 port, u16 *pkeys)
 
 		event.event = IB_EVENT_PKEY_CHANGE;
 		event.device = &dd->verbs_dev.ibdev;
-		event.element.port_num = 1;
+		event.element.port_num = port;
 		ib_dispatch_event(&event);
 	}
 	return 0;
-- 
2.0.0


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

* [PATCH 3.12 029/170] IB/ipath: Translate legacy diagpkt into newer extended diagpkt
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (27 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 028/170] IB/qib: Fix port in pkey change event Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 030/170] IB/srp: Fix a sporadic crash triggered by cable pulling Jiri Slaby
                   ` (141 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Dennis Dalessandro, Roland Dreier, Jiri Slaby

From: Dennis Dalessandro <dennis.dalessandro@intel.com>

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

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

commit 7e6d3e5c70f13874fb06e6b67696ed90ce79bd48 upstream.

This patch addresses an issue where the legacy diagpacket is sent in
from the user, but the driver operates on only the extended
diagpkt. This patch specifically initializes the extended diagpkt
based on the legacy packet.

Reported-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/infiniband/hw/ipath/ipath_diag.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/infiniband/hw/ipath/ipath_diag.c b/drivers/infiniband/hw/ipath/ipath_diag.c
index e2f9a51f4a38..45802e97332e 100644
--- a/drivers/infiniband/hw/ipath/ipath_diag.c
+++ b/drivers/infiniband/hw/ipath/ipath_diag.c
@@ -346,6 +346,10 @@ static ssize_t ipath_diagpkt_write(struct file *fp,
 			ret = -EFAULT;
 			goto bail;
 		}
+		dp.len = odp.len;
+		dp.unit = odp.unit;
+		dp.data = odp.data;
+		dp.pbc_wd = 0;
 	} else {
 		ret = -EINVAL;
 		goto bail;
-- 
2.0.0


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

* [PATCH 3.12 030/170] IB/srp: Fix a sporadic crash triggered by cable pulling
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (28 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 029/170] IB/ipath: Translate legacy diagpkt into newer extended diagpkt Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 031/170] IB/umad: Fix error handling Jiri Slaby
                   ` (140 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Bart Van Assche, Roland Dreier, Jiri Slaby

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

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

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

commit 024ca90151f5e4296d30f72c13ff9a075e23c9ec upstream.

Avoid that the loops that iterate over the request ring can encounter
a pointer to a SCSI command in req->scmnd that is no longer associated
with that request. If the function srp_unmap_data() is invoked twice
for a SCSI command that is not in flight then that would cause
ib_fmr_pool_unmap() to be invoked with an invalid pointer as argument,
resulting in a kernel oops.

Reported-by: Sagi Grimberg <sagig@mellanox.com>
Reference: http://thread.gmane.org/gmane.linux.drivers.rdma/19068/focus=19069
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/infiniband/ulp/srp/ib_srp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 17b58f4f0681..024fa025a7ab 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1412,6 +1412,12 @@ err_unmap:
 err_iu:
 	srp_put_tx_iu(target, iu, SRP_IU_CMD);
 
+	/*
+	 * Avoid that the loops that iterate over the request ring can
+	 * encounter a dangling SCSI command pointer.
+	 */
+	req->scmnd = NULL;
+
 	spin_lock_irqsave(&target->lock, flags);
 	list_add(&req->list, &target->free_reqs);
 
-- 
2.0.0


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

* [PATCH 3.12 031/170] IB/umad: Fix error handling
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (29 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 030/170] IB/srp: Fix a sporadic crash triggered by cable pulling Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 032/170] IB/umad: Fix use-after-free on close Jiri Slaby
                   ` (139 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Bart Van Assche, Yann Droneaud, Roland Dreier, Jiri Slaby

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

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

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

commit 8ec0a0e6b58218bdc1db91dd70ebfcd6ad8dd6cd upstream.

Avoid leaking a kref count in ib_umad_open() if port->ib_dev == NULL
or if nonseekable_open() fails.

Avoid leaking a kref count, that sm_sem is kept down and also that the
IB_PORT_SM capability mask is not cleared in ib_umad_sm_open() if
nonseekable_open() fails.

Since container_of() never returns NULL, remove the code that tests
whether container_of() returns NULL.

Moving the kref_get() call from the start of ib_umad_*open() to the
end is safe since it is the responsibility of the caller of these
functions to ensure that the cdev pointer remains valid until at least
when these functions return.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>

[ydroneaud@opteya.com: rework a bit to reduce the amount of code changed]

Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>

[ nonseekable_open() can't actually fail, but....  - Roland ]

Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/infiniband/core/user_mad.c | 49 +++++++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 22 deletions(-)

diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index f0d588f8859e..9bdf576cd4ab 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -780,27 +780,19 @@ static int ib_umad_open(struct inode *inode, struct file *filp)
 {
 	struct ib_umad_port *port;
 	struct ib_umad_file *file;
-	int ret;
+	int ret = -ENXIO;
 
 	port = container_of(inode->i_cdev, struct ib_umad_port, cdev);
-	if (port)
-		kref_get(&port->umad_dev->ref);
-	else
-		return -ENXIO;
 
 	mutex_lock(&port->file_mutex);
 
-	if (!port->ib_dev) {
-		ret = -ENXIO;
+	if (!port->ib_dev)
 		goto out;
-	}
 
+	ret = -ENOMEM;
 	file = kzalloc(sizeof *file, GFP_KERNEL);
-	if (!file) {
-		kref_put(&port->umad_dev->ref, ib_umad_release_dev);
-		ret = -ENOMEM;
+	if (!file)
 		goto out;
-	}
 
 	mutex_init(&file->mutex);
 	spin_lock_init(&file->send_lock);
@@ -814,6 +806,13 @@ static int ib_umad_open(struct inode *inode, struct file *filp)
 	list_add_tail(&file->port_list, &port->file_list);
 
 	ret = nonseekable_open(inode, filp);
+	if (ret) {
+		list_del(&file->port_list);
+		kfree(file);
+		goto out;
+	}
+
+	kref_get(&port->umad_dev->ref);
 
 out:
 	mutex_unlock(&port->file_mutex);
@@ -880,10 +879,6 @@ static int ib_umad_sm_open(struct inode *inode, struct file *filp)
 	int ret;
 
 	port = container_of(inode->i_cdev, struct ib_umad_port, sm_cdev);
-	if (port)
-		kref_get(&port->umad_dev->ref);
-	else
-		return -ENXIO;
 
 	if (filp->f_flags & O_NONBLOCK) {
 		if (down_trylock(&port->sm_sem)) {
@@ -898,17 +893,27 @@ static int ib_umad_sm_open(struct inode *inode, struct file *filp)
 	}
 
 	ret = ib_modify_port(port->ib_dev, port->port_num, 0, &props);
-	if (ret) {
-		up(&port->sm_sem);
-		goto fail;
-	}
+	if (ret)
+		goto err_up_sem;
 
 	filp->private_data = port;
 
-	return nonseekable_open(inode, filp);
+	ret = nonseekable_open(inode, filp);
+	if (ret)
+		goto err_clr_sm_cap;
+
+	kref_get(&port->umad_dev->ref);
+
+	return 0;
+
+err_clr_sm_cap:
+	swap(props.set_port_cap_mask, props.clr_port_cap_mask);
+	ib_modify_port(port->ib_dev, port->port_num, 0, &props);
+
+err_up_sem:
+	up(&port->sm_sem);
 
 fail:
-	kref_put(&port->umad_dev->ref, ib_umad_release_dev);
 	return ret;
 }
 
-- 
2.0.0


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

* [PATCH 3.12 032/170] IB/umad: Fix use-after-free on close
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (30 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 031/170] IB/umad: Fix error handling Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 033/170] SUNRPC: Fix a module reference leak in svc_handle_xprt Jiri Slaby
                   ` (138 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Bart Van Assche, Roland Dreier, Jiri Slaby

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

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

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

commit 60e1751cb52cc6d1ae04b6bd3c2b96e770b5823f upstream.

Avoid that closing /dev/infiniband/umad<n> or /dev/infiniband/issm<n>
triggers a use-after-free.  __fput() invokes f_op->release() before it
invokes cdev_put().  Make sure that the ib_umad_device structure is
freed by the cdev_put() call instead of f_op->release().  This avoids
that changing the port mode from IB into Ethernet and back to IB
followed by restarting opensmd triggers the following kernel oops:

    general protection fault: 0000 [#1] PREEMPT SMP
    RIP: 0010:[<ffffffff810cc65c>]  [<ffffffff810cc65c>] module_put+0x2c/0x170
    Call Trace:
     [<ffffffff81190f20>] cdev_put+0x20/0x30
     [<ffffffff8118e2ce>] __fput+0x1ae/0x1f0
     [<ffffffff8118e35e>] ____fput+0xe/0x10
     [<ffffffff810723bc>] task_work_run+0xac/0xe0
     [<ffffffff81002a9f>] do_notify_resume+0x9f/0xc0
     [<ffffffff814b8398>] int_signal+0x12/0x17

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=75051
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/infiniband/core/user_mad.c | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index 9bdf576cd4ab..1acb99100556 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -98,7 +98,7 @@ struct ib_umad_port {
 
 struct ib_umad_device {
 	int                  start_port, end_port;
-	struct kref          ref;
+	struct kobject       kobj;
 	struct ib_umad_port  port[0];
 };
 
@@ -134,14 +134,18 @@ static DECLARE_BITMAP(dev_map, IB_UMAD_MAX_PORTS);
 static void ib_umad_add_one(struct ib_device *device);
 static void ib_umad_remove_one(struct ib_device *device);
 
-static void ib_umad_release_dev(struct kref *ref)
+static void ib_umad_release_dev(struct kobject *kobj)
 {
 	struct ib_umad_device *dev =
-		container_of(ref, struct ib_umad_device, ref);
+		container_of(kobj, struct ib_umad_device, kobj);
 
 	kfree(dev);
 }
 
+static struct kobj_type ib_umad_dev_ktype = {
+	.release = ib_umad_release_dev,
+};
+
 static int hdr_size(struct ib_umad_file *file)
 {
 	return file->use_pkey_index ? sizeof (struct ib_user_mad_hdr) :
@@ -812,7 +816,7 @@ static int ib_umad_open(struct inode *inode, struct file *filp)
 		goto out;
 	}
 
-	kref_get(&port->umad_dev->ref);
+	kobject_get(&port->umad_dev->kobj);
 
 out:
 	mutex_unlock(&port->file_mutex);
@@ -851,7 +855,7 @@ static int ib_umad_close(struct inode *inode, struct file *filp)
 	mutex_unlock(&file->port->file_mutex);
 
 	kfree(file);
-	kref_put(&dev->ref, ib_umad_release_dev);
+	kobject_put(&dev->kobj);
 
 	return 0;
 }
@@ -902,7 +906,7 @@ static int ib_umad_sm_open(struct inode *inode, struct file *filp)
 	if (ret)
 		goto err_clr_sm_cap;
 
-	kref_get(&port->umad_dev->ref);
+	kobject_get(&port->umad_dev->kobj);
 
 	return 0;
 
@@ -932,7 +936,7 @@ static int ib_umad_sm_close(struct inode *inode, struct file *filp)
 
 	up(&port->sm_sem);
 
-	kref_put(&port->umad_dev->ref, ib_umad_release_dev);
+	kobject_put(&port->umad_dev->kobj);
 
 	return ret;
 }
@@ -1000,6 +1004,7 @@ static int find_overflow_devnum(void)
 }
 
 static int ib_umad_init_port(struct ib_device *device, int port_num,
+			     struct ib_umad_device *umad_dev,
 			     struct ib_umad_port *port)
 {
 	int devnum;
@@ -1032,6 +1037,7 @@ static int ib_umad_init_port(struct ib_device *device, int port_num,
 
 	cdev_init(&port->cdev, &umad_fops);
 	port->cdev.owner = THIS_MODULE;
+	port->cdev.kobj.parent = &umad_dev->kobj;
 	kobject_set_name(&port->cdev.kobj, "umad%d", port->dev_num);
 	if (cdev_add(&port->cdev, base, 1))
 		goto err_cdev;
@@ -1050,6 +1056,7 @@ static int ib_umad_init_port(struct ib_device *device, int port_num,
 	base += IB_UMAD_MAX_PORTS;
 	cdev_init(&port->sm_cdev, &umad_sm_fops);
 	port->sm_cdev.owner = THIS_MODULE;
+	port->sm_cdev.kobj.parent = &umad_dev->kobj;
 	kobject_set_name(&port->sm_cdev.kobj, "issm%d", port->dev_num);
 	if (cdev_add(&port->sm_cdev, base, 1))
 		goto err_sm_cdev;
@@ -1143,7 +1150,7 @@ static void ib_umad_add_one(struct ib_device *device)
 	if (!umad_dev)
 		return;
 
-	kref_init(&umad_dev->ref);
+	kobject_init(&umad_dev->kobj, &ib_umad_dev_ktype);
 
 	umad_dev->start_port = s;
 	umad_dev->end_port   = e;
@@ -1151,7 +1158,8 @@ static void ib_umad_add_one(struct ib_device *device)
 	for (i = s; i <= e; ++i) {
 		umad_dev->port[i - s].umad_dev = umad_dev;
 
-		if (ib_umad_init_port(device, i, &umad_dev->port[i - s]))
+		if (ib_umad_init_port(device, i, umad_dev,
+				      &umad_dev->port[i - s]))
 			goto err;
 	}
 
@@ -1163,7 +1171,7 @@ err:
 	while (--i >= s)
 		ib_umad_kill_port(&umad_dev->port[i - s]);
 
-	kref_put(&umad_dev->ref, ib_umad_release_dev);
+	kobject_put(&umad_dev->kobj);
 }
 
 static void ib_umad_remove_one(struct ib_device *device)
@@ -1177,7 +1185,7 @@ static void ib_umad_remove_one(struct ib_device *device)
 	for (i = 0; i <= umad_dev->end_port - umad_dev->start_port; ++i)
 		ib_umad_kill_port(&umad_dev->port[i]);
 
-	kref_put(&umad_dev->ref, ib_umad_release_dev);
+	kobject_put(&umad_dev->kobj);
 }
 
 static char *umad_devnode(struct device *dev, umode_t *mode)
-- 
2.0.0


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

* [PATCH 3.12 033/170] SUNRPC: Fix a module reference leak in svc_handle_xprt
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (31 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 032/170] IB/umad: Fix use-after-free on close Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 034/170] pNFS: Handle allocation errors correctly in filelayout_alloc_layout_hdr() Jiri Slaby
                   ` (137 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Trond Myklebust, J. Bruce Fields, Jiri Slaby

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

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

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

commit c789102c20bbbdda6831a273e046715be9d6af79 upstream.

If the accept() call fails, we need to put the module reference.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/sunrpc/svc_xprt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index 80a6640f329b..b9aad4723a9d 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -730,6 +730,8 @@ static int svc_handle_xprt(struct svc_rqst *rqstp, struct svc_xprt *xprt)
 		newxpt = xprt->xpt_ops->xpo_accept(xprt);
 		if (newxpt)
 			svc_add_new_temp_xprt(serv, newxpt);
+		else
+			module_put(xprt->xpt_class->xcl_owner);
 	} else if (xprt->xpt_ops->xpo_has_wspace(xprt)) {
 		/* XPT_DATA|XPT_DEFERRED case: */
 		dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n",
-- 
2.0.0


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

* [PATCH 3.12 034/170] pNFS: Handle allocation errors correctly in filelayout_alloc_layout_hdr()
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (32 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 033/170] SUNRPC: Fix a module reference leak in svc_handle_xprt Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 035/170] nfsd: getattr for FATTR4_WORD0_FILES_AVAIL needs the statfs buffer Jiri Slaby
                   ` (136 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 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 6df200f5d5191bdde4d2e408215383890f956781 upstream.

Return the NULL pointer when the allocation fails.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nfs/nfs4filelayout.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 394b0a0c54bf..3c27659aba7b 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -1330,7 +1330,7 @@ filelayout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
 	struct nfs4_filelayout *flo;
 
 	flo = kzalloc(sizeof(*flo), gfp_flags);
-	return &flo->generic_hdr;
+	return flo != NULL ? &flo->generic_hdr : NULL;
 }
 
 static void
-- 
2.0.0


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

* [PATCH 3.12 035/170] nfsd: getattr for FATTR4_WORD0_FILES_AVAIL needs the statfs buffer
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (33 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 034/170] pNFS: Handle allocation errors correctly in filelayout_alloc_layout_hdr() Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 036/170] NFS: Don't declare inode uptodate unless all attributes were checked Jiri Slaby
                   ` (135 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Christoph Hellwig, J. Bruce Fields, Jiri Slaby

From: Christoph Hellwig <hch@lst.de>

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

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

commit 12337901d654415d9f764b5f5ba50052e9700f37 upstream.

Note nobody's ever noticed because the typical client probably never
requests FILES_AVAIL without also requesting something else on the list.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nfsd/nfs4xdr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 4ab5ff492ca1..8fb749d7bbe6 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2113,8 +2113,8 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
 	err = vfs_getattr(&path, &stat);
 	if (err)
 		goto out_nfserr;
-	if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL |
-			FATTR4_WORD0_MAXNAME)) ||
+	if ((bmval0 & (FATTR4_WORD0_FILES_AVAIL | FATTR4_WORD0_FILES_FREE |
+			FATTR4_WORD0_FILES_TOTAL | FATTR4_WORD0_MAXNAME)) ||
 	    (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE |
 		       FATTR4_WORD1_SPACE_TOTAL))) {
 		err = vfs_statfs(&path, &statfs);
-- 
2.0.0


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

* [PATCH 3.12 036/170] NFS: Don't declare inode uptodate unless all attributes were checked
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (34 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 035/170] nfsd: getattr for FATTR4_WORD0_FILES_AVAIL needs the statfs buffer Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 037/170] NFS: populate ->net in mount data when remounting Jiri Slaby
                   ` (134 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 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 43b6535e717d2f656f71d9bd16022136b781c934 upstream.

Fix a bug, whereby nfs_update_inode() was declaring the inode to be
up to date despite not having checked all the attributes.
The bug occurs because the temporary variable in which we cache
the validity information is 'sanitised' before reapplying to
nfsi->cache_validity.

Reported-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nfs/inode.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index fdeeb28f287b..7f5799d098fd 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1540,18 +1540,20 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 			inode->i_version = fattr->change_attr;
 		}
 	} else if (server->caps & NFS_CAP_CHANGE_ATTR)
-		invalid |= save_cache_validity;
+		nfsi->cache_validity |= save_cache_validity;
 
 	if (fattr->valid & NFS_ATTR_FATTR_MTIME) {
 		memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime));
 	} else if (server->caps & NFS_CAP_MTIME)
-		invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
+		nfsi->cache_validity |= save_cache_validity &
+				(NFS_INO_INVALID_ATTR
 				| NFS_INO_REVAL_FORCED);
 
 	if (fattr->valid & NFS_ATTR_FATTR_CTIME) {
 		memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime));
 	} else if (server->caps & NFS_CAP_CTIME)
-		invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
+		nfsi->cache_validity |= save_cache_validity &
+				(NFS_INO_INVALID_ATTR
 				| NFS_INO_REVAL_FORCED);
 
 	/* Check if our cached file size is stale */
@@ -1574,7 +1576,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 					(long long)new_isize);
 		}
 	} else
-		invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
+		nfsi->cache_validity |= save_cache_validity &
+				(NFS_INO_INVALID_ATTR
 				| NFS_INO_REVAL_PAGECACHE
 				| NFS_INO_REVAL_FORCED);
 
@@ -1582,7 +1585,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 	if (fattr->valid & NFS_ATTR_FATTR_ATIME)
 		memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime));
 	else if (server->caps & NFS_CAP_ATIME)
-		invalid |= save_cache_validity & (NFS_INO_INVALID_ATIME
+		nfsi->cache_validity |= save_cache_validity &
+				(NFS_INO_INVALID_ATIME
 				| NFS_INO_REVAL_FORCED);
 
 	if (fattr->valid & NFS_ATTR_FATTR_MODE) {
@@ -1593,7 +1597,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 			invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
 		}
 	} else if (server->caps & NFS_CAP_MODE)
-		invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
+		nfsi->cache_validity |= save_cache_validity &
+				(NFS_INO_INVALID_ATTR
 				| NFS_INO_INVALID_ACCESS
 				| NFS_INO_INVALID_ACL
 				| NFS_INO_REVAL_FORCED);
@@ -1604,7 +1609,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 			inode->i_uid = fattr->uid;
 		}
 	} else if (server->caps & NFS_CAP_OWNER)
-		invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
+		nfsi->cache_validity |= save_cache_validity &
+				(NFS_INO_INVALID_ATTR
 				| NFS_INO_INVALID_ACCESS
 				| NFS_INO_INVALID_ACL
 				| NFS_INO_REVAL_FORCED);
@@ -1615,7 +1621,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 			inode->i_gid = fattr->gid;
 		}
 	} else if (server->caps & NFS_CAP_OWNER_GROUP)
-		invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
+		nfsi->cache_validity |= save_cache_validity &
+				(NFS_INO_INVALID_ATTR
 				| NFS_INO_INVALID_ACCESS
 				| NFS_INO_INVALID_ACL
 				| NFS_INO_REVAL_FORCED);
@@ -1628,7 +1635,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 			set_nlink(inode, fattr->nlink);
 		}
 	} else if (server->caps & NFS_CAP_NLINK)
-		invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
+		nfsi->cache_validity |= save_cache_validity &
+				(NFS_INO_INVALID_ATTR
 				| NFS_INO_REVAL_FORCED);
 
 	if (fattr->valid & NFS_ATTR_FATTR_SPACE_USED) {
-- 
2.0.0


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

* [PATCH 3.12 037/170] NFS: populate ->net in mount data when remounting
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (35 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 036/170] NFS: Don't declare inode uptodate unless all attributes were checked Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 038/170] nfs: Fix cache_validity check in nfs_write_pageuptodate() Jiri Slaby
                   ` (133 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Mateusz Guzik, linux-nfs, Trond Myklebust, Jiri Slaby

From: Mateusz Guzik <mguzik@redhat.com>

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

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

commit a914722f333b3359d2f4f12919380a334176bb89 upstream.

Otherwise the kernel oopses when remounting with IPv6 server because
net is dereferenced in dev_get_by_name.

Use net ns of current thread so that dev_get_by_name does not operate on
foreign ns. Changing the address is prohibited anyway so this should not
affect anything.

Signed-off-by: Mateusz Guzik <mguzik@redhat.com>
Cc: linux-nfs@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nfs/super.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index a03b9c6f9489..64940b5286db 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2197,6 +2197,7 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data)
 	data->timeo = 10U * nfss->client->cl_timeout->to_initval / HZ;
 	data->nfs_server.port = nfss->port;
 	data->nfs_server.addrlen = nfss->nfs_client->cl_addrlen;
+	data->net = current->nsproxy->net_ns;
 	memcpy(&data->nfs_server.address, &nfss->nfs_client->cl_addr,
 		data->nfs_server.addrlen);
 
-- 
2.0.0


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

* [PATCH 3.12 038/170] nfs: Fix cache_validity check in nfs_write_pageuptodate()
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (36 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 037/170] NFS: populate ->net in mount data when remounting Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 039/170] powerpc/pseries: Fix overwritten PE state Jiri Slaby
                   ` (132 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Scott Mayhew, Trond Myklebust, Jiri Slaby

From: Scott Mayhew <smayhew@redhat.com>

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

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

commit 18dd78c427513fb0f89365138be66e6ee8700d1b upstream.

NFS_INO_INVALID_DATA cannot be ignored, even if we have a delegation.

We're still having some problems with data corruption when multiple
clients are appending to a file and those clients are being granted
write delegations on open.

To reproduce:

Client A:
vi /mnt/`hostname -s`
while :; do echo "XXXXXXXXXXXXXXX" >>/mnt/file; sleep $(( $RANDOM % 5 )); done

Client B:
vi /mnt/`hostname -s`
while :; do echo "YYYYYYYYYYYYYYY" >>/mnt/file; sleep $(( $RANDOM % 5 )); done

What's happening is that in nfs_update_inode() we're recognizing that
the file size has changed and we're setting NFS_INO_INVALID_DATA
accordingly, but then we ignore the cache_validity flags in
nfs_write_pageuptodate() because we have a delegation.  As a result,
in nfs_updatepage() we're extending the write to cover the full page
even though we've not read in the data to begin with.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nfs/write.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index c6aa89f92558..3a1b1d1a27ce 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -913,12 +913,14 @@ static bool nfs_write_pageuptodate(struct page *page, struct inode *inode)
 
 	if (nfs_have_delegated_attributes(inode))
 		goto out;
-	if (nfsi->cache_validity & (NFS_INO_INVALID_DATA|NFS_INO_REVAL_PAGECACHE))
+	if (nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE)
 		return false;
 	smp_rmb();
 	if (test_bit(NFS_INO_INVALIDATING, &nfsi->flags))
 		return false;
 out:
+	if (nfsi->cache_validity & NFS_INO_INVALID_DATA)
+		return false;
 	return PageUptodate(page) != 0;
 }
 
-- 
2.0.0


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

* [PATCH 3.12 039/170] powerpc/pseries: Fix overwritten PE state
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (37 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 038/170] nfs: Fix cache_validity check in nfs_write_pageuptodate() Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 040/170] powerpc/mm: Check paca psize is up to date for huge mappings Jiri Slaby
                   ` (131 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Gavin Shan, Benjamin Herrenschmidt, Jiri Slaby

From: Gavin Shan <gwshan@linux.vnet.ibm.com>

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

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

commit 54f112a3837d4e7532bbedbbbf27c0de277be510 upstream.

In pseries_eeh_get_state(), EEH_STATE_UNAVAILABLE is always
overwritten by EEH_STATE_NOT_SUPPORT because of the missed
"break" there. The patch fixes the issue.

Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/platforms/pseries/eeh_pseries.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
index 7fbc25b1813f..74448701b636 100644
--- a/arch/powerpc/platforms/pseries/eeh_pseries.c
+++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
@@ -461,6 +461,7 @@ static int pseries_eeh_get_state(struct eeh_pe *pe, int *state)
 			} else {
 				result = EEH_STATE_NOT_SUPPORT;
 			}
+			break;
 		default:
 			result = EEH_STATE_NOT_SUPPORT;
 		}
-- 
2.0.0


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

* [PATCH 3.12 040/170] powerpc/mm: Check paca psize is up to date for huge mappings
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (38 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 039/170] powerpc/pseries: Fix overwritten PE state Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 041/170] powerpc/serial: Use saner flags when creating legacy ports Jiri Slaby
                   ` (130 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Michael Ellerman, Benjamin Herrenschmidt, Jiri Slaby

From: Michael Ellerman <mpe@ellerman.id.au>

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

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

commit 09567e7fd44291bfc08accfdd67ad8f467842332 upstream.

We have a bug in our hugepage handling which exhibits as an infinite
loop of hash faults. If the fault is being taken in the kernel it will
typically trigger the softlockup detector, or the RCU stall detector.

The bug is as follows:

 1. mmap(0xa0000000, ..., MAP_FIXED | MAP_HUGE_TLB | MAP_ANONYMOUS ..)
 2. Slice code converts the slice psize to 16M.
 3. The code on lines 539-540 of slice.c in slice_get_unmapped_area()
    synchronises the mm->context with the paca->context. So the paca slice
    mask is updated to include the 16M slice.
 3. Either:
    * mmap() fails because there are no huge pages available.
    * mmap() succeeds and the mapping is then munmapped.
    In both cases the slice psize remains at 16M in both the paca & mm.
 4. mmap(0xa0000000, ..., MAP_FIXED | MAP_ANONYMOUS ..)
 5. The slice psize is converted back to 64K. Because of the check on line 539
    of slice.c we DO NOT update the paca->context. The paca slice mask is now
    out of sync with the mm slice mask.
 6. User/kernel accesses 0xa0000000.
 7. The SLB miss handler slb_allocate_realmode() **uses the paca slice mask**
    to create an SLB entry and inserts it in the SLB.
18. With the 16M SLB entry in place the hardware does a hash lookup, no entry
    is found so a data access exception is generated.
19. The data access handler calls do_page_fault() -> handle_mm_fault().
10. __handle_mm_fault() creates a THP mapping with do_huge_pmd_anonymous_page().
11. The hardware retries the access, there is still nothing in the hash table
    so once again a data access exception is generated.
12. hash_page() calls into __hash_page_thp() and inserts a mapping in the
    hash. Although the THP mapping maps 16M the hashing is done using 64K
    as the segment page size.
13. hash_page() returns immediately after calling __hash_page_thp(), skipping
    over the code at line 1125. Resulting in the mismatch between the
    paca->context and mm->context not being detected.
14. The hardware retries the access, the hash it generates using the 16M
    SLB entry does NOT match the hash we inserted.
15. We take another data access and go into __hash_page_thp().
16. We see a valid entry in the hpte_slot_array and so we call updatepp()
    which succeeds.
17. Goto 14.

We could fix this in two ways. The first would be to remove or modify
the check on line 539 of slice.c.

The second option is to cause the check of paca psize in hash_page() on
line 1125 to also be done for THP pages.

We prefer the latter, because the check & update of the paca psize is
not done until we know it's necessary. It's also done only on the
current cpu, so we don't need to IPI all other cpus.

Without further rearranging the code, the simplest fix is to pull out
the code that checks paca psize and call it in two places. Firstly for
THP/hugetlb, and secondly for other mappings as before.

Thanks to Dave Jones for trinity, which originally found this bug.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/mm/hash_utils_64.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index bde8b5589755..503a5d005622 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -947,6 +947,22 @@ void hash_failure_debug(unsigned long ea, unsigned long access,
 		trap, vsid, ssize, psize, lpsize, pte);
 }
 
+static void check_paca_psize(unsigned long ea, struct mm_struct *mm,
+			     int psize, bool user_region)
+{
+	if (user_region) {
+		if (psize != get_paca_psize(ea)) {
+			get_paca()->context = mm->context;
+			slb_flush_and_rebolt();
+		}
+	} else if (get_paca()->vmalloc_sllp !=
+		   mmu_psize_defs[mmu_vmalloc_psize].sllp) {
+		get_paca()->vmalloc_sllp =
+			mmu_psize_defs[mmu_vmalloc_psize].sllp;
+		slb_vmalloc_update();
+	}
+}
+
 /* Result code is:
  *  0 - handled
  *  1 - normal page fault
@@ -1068,6 +1084,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
 			WARN_ON(1);
 		}
 #endif
+		check_paca_psize(ea, mm, psize, user_region);
+
 		goto bail;
 	}
 
@@ -1108,17 +1126,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
 #endif
 		}
 	}
-	if (user_region) {
-		if (psize != get_paca_psize(ea)) {
-			get_paca()->context = mm->context;
-			slb_flush_and_rebolt();
-		}
-	} else if (get_paca()->vmalloc_sllp !=
-		   mmu_psize_defs[mmu_vmalloc_psize].sllp) {
-		get_paca()->vmalloc_sllp =
-			mmu_psize_defs[mmu_vmalloc_psize].sllp;
-		slb_vmalloc_update();
-	}
+
+	check_paca_psize(ea, mm, psize, user_region);
 #endif /* CONFIG_PPC_64K_PAGES */
 
 #ifdef CONFIG_PPC_HAS_HASH_64K
-- 
2.0.0


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

* [PATCH 3.12 041/170] powerpc/serial: Use saner flags when creating legacy ports
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (39 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 040/170] powerpc/mm: Check paca psize is up to date for huge mappings Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 042/170] powerpc: 64bit sendfile is capped at 2GB Jiri Slaby
                   ` (129 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Benjamin Herrenschmidt, Jiri Slaby

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

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

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

commit c4cad90f9e9dcb85afc5e75a02ae3522ed077296 upstream.

We had a mix & match of flags used when creating legacy ports
depending on where we found them in the device-tree. Among others
we were missing UPF_SKIP_TEST for some kind of ISA ports which is
a problem as quite a few UARTs out there don't support the loopback
test (such as a lot of BMCs).

Let's pick the set of flags used by the SoC code and generalize it
which means autoconf, no loopback test, irq maybe shared and fixed
port.

Sending to stable as the lack of UPF_SKIP_TEST is breaking
serial on some machines so I want this back into distros

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/kernel/legacy_serial.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 22e88dd2f34a..a531358f971e 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -48,6 +48,9 @@ static struct __initdata of_device_id legacy_serial_parents[] = {
 static unsigned int legacy_serial_count;
 static int legacy_serial_console = -1;
 
+static const upf_t legacy_port_flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
+	UPF_SHARE_IRQ | UPF_FIXED_PORT;
+
 static unsigned int tsi_serial_in(struct uart_port *p, int offset)
 {
 	unsigned int tmp;
@@ -153,8 +156,6 @@ static int __init add_legacy_soc_port(struct device_node *np,
 {
 	u64 addr;
 	const __be32 *addrp;
-	upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ
-		| UPF_FIXED_PORT;
 	struct device_node *tsi = of_get_parent(np);
 
 	/* We only support ports that have a clock frequency properly
@@ -185,9 +186,11 @@ static int __init add_legacy_soc_port(struct device_node *np,
 	 * IO port value. It will be fixed up later along with the irq
 	 */
 	if (tsi && !strcmp(tsi->type, "tsi-bridge"))
-		return add_legacy_port(np, -1, UPIO_TSI, addr, addr, NO_IRQ, flags, 0);
+		return add_legacy_port(np, -1, UPIO_TSI, addr, addr,
+				       NO_IRQ, legacy_port_flags, 0);
 	else
-		return add_legacy_port(np, -1, UPIO_MEM, addr, addr, NO_IRQ, flags, 0);
+		return add_legacy_port(np, -1, UPIO_MEM, addr, addr,
+				       NO_IRQ, legacy_port_flags, 0);
 }
 
 static int __init add_legacy_isa_port(struct device_node *np,
@@ -233,7 +236,7 @@ static int __init add_legacy_isa_port(struct device_node *np,
 
 	/* Add port, irq will be dealt with later */
 	return add_legacy_port(np, index, UPIO_PORT, be32_to_cpu(reg[1]),
-			       taddr, NO_IRQ, UPF_BOOT_AUTOCONF, 0);
+			       taddr, NO_IRQ, legacy_port_flags, 0);
 
 }
 
@@ -306,7 +309,7 @@ static int __init add_legacy_pci_port(struct device_node *np,
 	 * IO port value. It will be fixed up later along with the irq
 	 */
 	return add_legacy_port(np, index, iotype, base, addr, NO_IRQ,
-			       UPF_BOOT_AUTOCONF, np != pci_dev);
+			       legacy_port_flags, np != pci_dev);
 }
 #endif
 
-- 
2.0.0


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

* [PATCH 3.12 042/170] powerpc: 64bit sendfile is capped at 2GB
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (40 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 041/170] powerpc/serial: Use saner flags when creating legacy ports Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 043/170] powerpc: fix typo 'CONFIG_PMAC' Jiri Slaby
                   ` (128 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Anton Blanchard, Benjamin Herrenschmidt, Jiri Slaby

From: Anton Blanchard <anton@samba.org>

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

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

commit 5d73320a96fcce80286f1447864c481b5f0b96fa upstream.

commit 8f9c0119d7ba (compat: fs: Generic compat_sys_sendfile
implementation) changed the PowerPC 64bit sendfile call from
sys_sendile64 to sys_sendfile.

Unfortunately this broke sendfile of lengths greater than 2G because
sys_sendfile caps at MAX_NON_LFS. Restore what we had previously which
fixes the bug.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/include/asm/systbl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index 43523fe0d8b4..05fcdd826829 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -190,7 +190,7 @@ SYSCALL_SPU(getcwd)
 SYSCALL_SPU(capget)
 SYSCALL_SPU(capset)
 COMPAT_SYS(sigaltstack)
-COMPAT_SYS_SPU(sendfile)
+SYSX_SPU(sys_sendfile64,compat_sys_sendfile,sys_sendfile)
 SYSCALL(ni_syscall)
 SYSCALL(ni_syscall)
 PPC_SYS(vfork)
-- 
2.0.0


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

* [PATCH 3.12 043/170] powerpc: fix typo 'CONFIG_PMAC'
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (41 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 042/170] powerpc: 64bit sendfile is capped at 2GB Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 044/170] powerpc/perf: Ensure all EBB register state is cleared on fork() Jiri Slaby
                   ` (127 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Paul Bolle, Benjamin Herrenschmidt, Jiri Slaby

From: Paul Bolle <pebolle@tiscali.nl>

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

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

commit 6e0fdf9af216887e0032c19d276889aad41cad00 upstream.

Commit b0d278b7d3ae ("powerpc/perf_event: Reduce latency of calling
perf_event_do_pending") added a check for CONFIG_PMAC were a check for
CONFIG_PPC_PMAC was clearly intended.

Fixes: b0d278b7d3ae ("powerpc/perf_event: Reduce latency of calling perf_event_do_pending")
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/kernel/time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index b3b144121cc9..62e7f22e57d5 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -512,7 +512,7 @@ void timer_interrupt(struct pt_regs * regs)
 
 	__get_cpu_var(irq_stat).timer_irqs++;
 
-#if defined(CONFIG_PPC32) && defined(CONFIG_PMAC)
+#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC)
 	if (atomic_read(&ppc_n_lost_interrupts) != 0)
 		do_IRQ(regs);
 #endif
-- 
2.0.0


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

* [PATCH 3.12 044/170] powerpc/perf: Ensure all EBB register state is cleared on fork()
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (42 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 043/170] powerpc: fix typo 'CONFIG_PMAC' Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 045/170] powerpc: fix typo 'CONFIG_PPC_CPU' Jiri Slaby
                   ` (126 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Michael Ellerman, Benjamin Herrenschmidt, Jiri Slaby

From: Michael Ellerman <mpe@ellerman.id.au>

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

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

commit 3df48c981d5a9610e02e9270b1bc4274fb536710 upstream.

In commit 330a1eb "Core EBB support for 64-bit book3s" I messed up
clear_task_ebb(). It clears some but not all of the task's Event Based
Branch (EBB) registers when we duplicate a task struct.

That allows a child task to observe the EBBHR & EBBRR of its parent,
which it should not be able to do.

Fix it by clearing EBBHR & EBBRR.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/include/asm/switch_to.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
index 2be5618cdec6..06d63a3c1a88 100644
--- a/arch/powerpc/include/asm/switch_to.h
+++ b/arch/powerpc/include/asm/switch_to.h
@@ -85,6 +85,8 @@ static inline void clear_task_ebb(struct task_struct *t)
 {
 #ifdef CONFIG_PPC_BOOK3S_64
     /* EBB perf events are not inherited, so clear all EBB state. */
+    t->thread.ebbrr = 0;
+    t->thread.ebbhr = 0;
     t->thread.bescr = 0;
     t->thread.mmcr2 = 0;
     t->thread.mmcr0 = 0;
-- 
2.0.0


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

* [PATCH 3.12 045/170] powerpc: fix typo 'CONFIG_PPC_CPU'
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (43 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 044/170] powerpc/perf: Ensure all EBB register state is cleared on fork() Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 046/170] powerpc: Don't setup CPUs with bad status Jiri Slaby
                   ` (125 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Paul Bolle, Benjamin Herrenschmidt, Jiri Slaby

From: Paul Bolle <pebolle@tiscali.nl>

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

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

commit b69a1da94f3d1589d1942b5d1b384d8cfaac4500 upstream.

Commit cd64d1697cf0 ("powerpc: mtmsrd not defined") added a check for
CONFIG_PPC_CPU were a check for CONFIG_PPC_FPU was clearly intended.

Fixes: cd64d1697cf0 ("powerpc: mtmsrd not defined")
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/lib/sstep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index b1faa1593c90..aec4dbf5a5cc 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -1397,7 +1397,7 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
 				regs->gpr[rd] = byterev_4(val);
 			goto ldst_done;
 
-#ifdef CONFIG_PPC_CPU
+#ifdef CONFIG_PPC_FPU
 		case 535:	/* lfsx */
 		case 567:	/* lfsux */
 			if (!(regs->msr & MSR_FP))
-- 
2.0.0


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

* [PATCH 3.12 046/170] powerpc: Don't setup CPUs with bad status
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (44 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 045/170] powerpc: fix typo 'CONFIG_PPC_CPU' Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 047/170] powerpc: Add AT_HWCAP2 to indicate V.CRYPTO category support Jiri Slaby
                   ` (124 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Michael Neuling, Benjamin Herrenschmidt, Jiri Slaby

From: Michael Neuling <mikey@neuling.org>

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

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

commit 59a53afe70fd530040bdc69581f03d880157f15a upstream.

OPAL will mark a CPU that is guarded as "bad" in the status property of the CPU
node.

Unfortunatley Linux doesn't check this property and will put the bad CPU in the
present map.  This has caused hangs on booting when we try to unsplit the core.

This patch checks the CPU is avaliable via this status property before putting
it in the present map.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Tested-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/kernel/setup-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 3d261c071fc8..0623cf3f8a61 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -460,7 +460,7 @@ void __init smp_setup_cpu_maps(void)
 		for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) {
 			DBG("    thread %d -> cpu %d (hard id %d)\n",
 			    j, cpu, be32_to_cpu(intserv[j]));
-			set_cpu_present(cpu, true);
+			set_cpu_present(cpu, of_device_is_available(dn));
 			set_hard_smp_processor_id(cpu, be32_to_cpu(intserv[j]));
 			set_cpu_possible(cpu, true);
 			cpu++;
-- 
2.0.0


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

* [PATCH 3.12 047/170] powerpc: Add AT_HWCAP2 to indicate V.CRYPTO category support
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (45 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 046/170] powerpc: Don't setup CPUs with bad status Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 048/170] powerpc: Don't skip ePAPR spin-table CPUs Jiri Slaby
                   ` (123 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Benjamin Herrenschmidt, Jiri Slaby

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

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

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

commit dd58a092c4202f2bd490adab7285b3ff77f8e467 upstream.

The Vector Crypto category instructions are supported by current POWER8
chips, advertise them to userspace using a specific bit to properly
differentiate with chips of the same architecture level that might not
have them.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/include/uapi/asm/cputable.h | 1 +
 arch/powerpc/kernel/cputable.c           | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/uapi/asm/cputable.h b/arch/powerpc/include/uapi/asm/cputable.h
index 5b7657959faa..de2c0e4ee1aa 100644
--- a/arch/powerpc/include/uapi/asm/cputable.h
+++ b/arch/powerpc/include/uapi/asm/cputable.h
@@ -41,5 +41,6 @@
 #define PPC_FEATURE2_EBB		0x10000000
 #define PPC_FEATURE2_ISEL		0x08000000
 #define PPC_FEATURE2_TAR		0x04000000
+#define PPC_FEATURE2_VEC_CRYPTO		0x02000000
 
 #endif /* _UAPI__ASM_POWERPC_CPUTABLE_H */
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 597d954e5860..c5d3d023363a 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -105,7 +105,8 @@ extern void __restore_cpu_e6500(void);
 				 PPC_FEATURE_PSERIES_PERFMON_COMPAT)
 #define COMMON_USER2_POWER8	(PPC_FEATURE2_ARCH_2_07 | \
 				 PPC_FEATURE2_HTM_COMP | PPC_FEATURE2_DSCR | \
-				 PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR)
+				 PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | \
+				 PPC_FEATURE2_VEC_CRYPTO)
 #define COMMON_USER_PA6T	(COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\
 				 PPC_FEATURE_TRUE_LE | \
 				 PPC_FEATURE_HAS_ALTIVEC_COMP)
-- 
2.0.0


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

* [PATCH 3.12 048/170] powerpc: Don't skip ePAPR spin-table CPUs
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (46 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 047/170] powerpc: Add AT_HWCAP2 to indicate V.CRYPTO category support Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 049/170] reiserfs: call truncate_setsize under tailpack mutex Jiri Slaby
                   ` (122 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Scott Wood, Michael Neuling, Emil Medve,
	Benjamin Herrenschmidt, Jiri Slaby

From: Scott Wood <scottwood@freescale.com>

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

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

commit 6663a4fa6711050036562ddfd2086edf735fae21 upstream.

Commit 59a53afe70fd530040bdc69581f03d880157f15a "powerpc: Don't setup
CPUs with bad status" broke ePAPR SMP booting.  ePAPR says that CPUs
that aren't presently running shall have status of disabled, with
enable-method being used to determine whether the CPU can be enabled.

Fix by checking for spin-table, which is currently the only supported
enable-method.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Michael Neuling <mikey@neuling.org>
Cc: Emil Medve <Emilian.Medve@Freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/kernel/setup-common.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 0623cf3f8a61..5b86d6a47a1a 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -458,9 +458,17 @@ void __init smp_setup_cpu_maps(void)
 		}
 
 		for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) {
+			bool avail;
+
 			DBG("    thread %d -> cpu %d (hard id %d)\n",
 			    j, cpu, be32_to_cpu(intserv[j]));
-			set_cpu_present(cpu, of_device_is_available(dn));
+
+			avail = of_device_is_available(dn);
+			if (!avail)
+				avail = !of_property_match_string(dn,
+						"enable-method", "spin-table");
+
+			set_cpu_present(cpu, avail);
 			set_hard_smp_processor_id(cpu, be32_to_cpu(intserv[j]));
 			set_cpu_possible(cpu, true);
 			cpu++;
-- 
2.0.0


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

* [PATCH 3.12 049/170] reiserfs: call truncate_setsize under tailpack mutex
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (47 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 048/170] powerpc: Don't skip ePAPR spin-table CPUs Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 050/170] MIPS: KVM: Remove redundant NULL checks before kfree() Jiri Slaby
                   ` (121 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jeff Mahoney, Jan Kara, Jiri Slaby

From: Jeff Mahoney <jeffm@suse.com>

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

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

commit 22e7478ddbcb670e33fab72d0bbe7c394c3a2c84 upstream.

Prior to commit 0e4f6a791b1e (Fix reiserfs_file_release()), reiserfs
truncates serialized on i_mutex. They mostly still do, with the exception
of reiserfs_file_release. That blocks out other writers via the tailpack
mutex and the inode openers counter adjusted in reiserfs_file_open.

However, NFS will call reiserfs_setattr without having called ->open, so
we end up with a race when nfs is calling ->setattr while another
process is releasing the file. Ultimately, it triggers the
BUG_ON(inode->i_size != new_file_size) check in maybe_indirect_to_direct.

The solution is to pull the lock into reiserfs_setattr to encompass the
truncate_setsize call as well.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/reiserfs/inode.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index ad62bdbb451e..1e4cf9d73130 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -3220,8 +3220,14 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
 	    attr->ia_size != i_size_read(inode)) {
 		error = inode_newsize_ok(inode, attr->ia_size);
 		if (!error) {
+			/*
+			 * Could race against reiserfs_file_release
+			 * if called from NFS, so take tailpack mutex.
+			 */
+			mutex_lock(&REISERFS_I(inode)->tailpack);
 			truncate_setsize(inode, attr->ia_size);
-			reiserfs_vfs_truncate_file(inode);
+			reiserfs_truncate_file(inode, 1);
+			mutex_unlock(&REISERFS_I(inode)->tailpack);
 		}
 	}
 
-- 
2.0.0


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

* [PATCH 3.12 050/170] MIPS: KVM: Remove redundant NULL checks before kfree()
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (48 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 049/170] reiserfs: call truncate_setsize under tailpack mutex Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 051/170] MIPS: KVM: Fix memory leak on VCPU Jiri Slaby
                   ` (120 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 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 c6c0a6637f9da54f9472144d44f71cf847f92e20 upstream.

The kfree() function already NULL checks the parameter so remove the
redundant NULL checks before kfree() calls in arch/mips/kvm/.

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 | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index b31153969946..8b900e987338 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -149,9 +149,7 @@ void kvm_mips_free_vcpus(struct kvm *kvm)
 		if (kvm->arch.guest_pmap[i] != KVM_INVALID_PAGE)
 			kvm_mips_release_pfn_clean(kvm->arch.guest_pmap[i]);
 	}
-
-	if (kvm->arch.guest_pmap)
-		kfree(kvm->arch.guest_pmap);
+	kfree(kvm->arch.guest_pmap);
 
 	kvm_for_each_vcpu(i, vcpu, kvm) {
 		kvm_arch_vcpu_free(vcpu);
@@ -388,12 +386,8 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
 
 	kvm_mips_dump_stats(vcpu);
 
-	if (vcpu->arch.guest_ebase)
-		kfree(vcpu->arch.guest_ebase);
-
-	if (vcpu->arch.kseg0_commpage)
-		kfree(vcpu->arch.kseg0_commpage);
-
+	kfree(vcpu->arch.guest_ebase);
+	kfree(vcpu->arch.kseg0_commpage);
 }
 
 void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
-- 
2.0.0


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

* [PATCH 3.12 051/170] MIPS: KVM: Fix memory leak on VCPU
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (49 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 050/170] MIPS: KVM: Remove redundant NULL checks before kfree() Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 052/170] ipvs: Fix panic due to non-linear skb Jiri Slaby
                   ` (119 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Deng-Cheng Zhu, Paolo Bonzini, Jiri Slaby

From: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>

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

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

commit 8c9eb041cf76038eb3b62ee259607eec9b89f48d upstream.

kvm_arch_vcpu_free() is called in 2 code paths:

1) kvm_vm_ioctl()
       kvm_vm_ioctl_create_vcpu()
           kvm_arch_vcpu_destroy()
               kvm_arch_vcpu_free()
2) kvm_put_kvm()
       kvm_destroy_vm()
           kvm_arch_destroy_vm()
               kvm_mips_free_vcpus()
                   kvm_arch_vcpu_free()

Neither of the paths handles VCPU free. We need to do it in
kvm_arch_vcpu_free() corresponding to the memory allocation in
kvm_arch_vcpu_create().

Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/mips/kvm/kvm_mips.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index 8b900e987338..3f3e5b2b2f38 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -388,6 +388,7 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
 
 	kfree(vcpu->arch.guest_ebase);
 	kfree(vcpu->arch.kseg0_commpage);
+	kfree(vcpu);
 }
 
 void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
-- 
2.0.0


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

* [PATCH 3.12 052/170] ipvs: Fix panic due to non-linear skb
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (50 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 051/170] MIPS: KVM: Fix memory leak on VCPU Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 053/170] ptrace,x86: force IRET path after a ptrace_stop() Jiri Slaby
                   ` (118 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Peter Christensen, Simon Horman, Jiri Slaby

From: Peter Christensen <pch@ordbogen.com>

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

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

commit f44a5f45f544561302e855e7bd104e5f506ec01b upstream.

Receiving a ICMP response to an IPIP packet in a non-linear skb could
cause a kernel panic in __skb_pull.

The problem was introduced in
commit f2edb9f7706dcb2c0d9a362b2ba849efe3a97f5e ("ipvs: implement
passive PMTUD for IPIP packets").

Signed-off-by: Peter Christensen <pch@ordbogen.com>
Acked-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 | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 3581736446d5..e2d38e5318d4 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1392,15 +1392,19 @@ ip_vs_in_icmp(struct sk_buff *skb, int *related, unsigned int hooknum)
 
 	if (ipip) {
 		__be32 info = ic->un.gateway;
+		__u8 type = ic->type;
+		__u8 code = ic->code;
 
 		/* Update the MTU */
 		if (ic->type == ICMP_DEST_UNREACH &&
 		    ic->code == ICMP_FRAG_NEEDED) {
 			struct ip_vs_dest *dest = cp->dest;
 			u32 mtu = ntohs(ic->un.frag.mtu);
+			__be16 frag_off = cih->frag_off;
 
 			/* Strip outer IP and ICMP, go to IPIP header */
-			__skb_pull(skb, ihl + sizeof(_icmph));
+			if (pskb_pull(skb, ihl + sizeof(_icmph)) == NULL)
+				goto ignore_ipip;
 			offset2 -= ihl + sizeof(_icmph);
 			skb_reset_network_header(skb);
 			IP_VS_DBG(12, "ICMP for IPIP %pI4->%pI4: mtu=%u\n",
@@ -1408,7 +1412,7 @@ ip_vs_in_icmp(struct sk_buff *skb, int *related, unsigned int hooknum)
 			ipv4_update_pmtu(skb, dev_net(skb->dev),
 					 mtu, 0, 0, 0, 0);
 			/* Client uses PMTUD? */
-			if (!(cih->frag_off & htons(IP_DF)))
+			if (!(frag_off & htons(IP_DF)))
 				goto ignore_ipip;
 			/* Prefer the resulting PMTU */
 			if (dest) {
@@ -1427,12 +1431,13 @@ ip_vs_in_icmp(struct sk_buff *skb, int *related, unsigned int hooknum)
 		/* Strip outer IP, ICMP and IPIP, go to IP header of
 		 * original request.
 		 */
-		__skb_pull(skb, offset2);
+		if (pskb_pull(skb, offset2) == NULL)
+			goto ignore_ipip;
 		skb_reset_network_header(skb);
 		IP_VS_DBG(12, "Sending ICMP for %pI4->%pI4: t=%u, c=%u, i=%u\n",
 			&ip_hdr(skb)->saddr, &ip_hdr(skb)->daddr,
-			ic->type, ic->code, ntohl(info));
-		icmp_send(skb, ic->type, ic->code, info);
+			type, code, ntohl(info));
+		icmp_send(skb, type, code, info);
 		/* ICMP can be shorter but anyways, account it */
 		ip_vs_out_stats(cp, skb);
 
-- 
2.0.0


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

* [PATCH 3.12 053/170] ptrace,x86: force IRET path after a ptrace_stop()
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (51 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 052/170] ipvs: Fix panic due to non-linear skb Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 054/170] lz4: add overrun checks to lz4_uncompress_unknownoutputsize() Jiri Slaby
                   ` (117 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Tejun Heo, Linus Torvalds, Jiri Slaby

From: Tejun Heo <tj@kernel.org>

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

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

commit b9cd18de4db3c9ffa7e17b0dc0ca99ed5aa4d43a upstream.

The 'sysret' fastpath does not correctly restore even all regular
registers, much less any segment registers or reflags values.  That is
very much part of why it's faster than 'iret'.

Normally that isn't a problem, because the normal ptrace() interface
catches the process using the signal handler infrastructure, which
always returns with an iret.

However, some paths can get caught using ptrace_event() instead of the
signal path, and for those we need to make sure that we aren't going to
return to user space using 'sysret'.  Otherwise the modifications that
may have been done to the register set by the tracer wouldn't
necessarily take effect.

Fix it by forcing IRET path by setting TIF_NOTIFY_RESUME from
arch_ptrace_stop_needed() which is invoked from ptrace_stop().

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Andy Lutomirski <luto@amacapital.net>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/include/asm/ptrace.h | 16 ++++++++++++++++
 include/linux/ptrace.h        |  3 +++
 2 files changed, 19 insertions(+)

diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 942a08623a1a..68e9f007cd4a 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -232,6 +232,22 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
 
 #define ARCH_HAS_USER_SINGLE_STEP_INFO
 
+/*
+ * When hitting ptrace_stop(), we cannot return using SYSRET because
+ * that does not restore the full CPU state, only a minimal set.  The
+ * ptracer can change arbitrary register values, which is usually okay
+ * because the usual ptrace stops run off the signal delivery path which
+ * forces IRET; however, ptrace_event() stops happen in arbitrary places
+ * in the kernel and don't force IRET path.
+ *
+ * So force IRET path after a ptrace stop.
+ */
+#define arch_ptrace_stop_needed(code, info)				\
+({									\
+	set_thread_flag(TIF_NOTIFY_RESUME);				\
+	false;								\
+})
+
 struct user_desc;
 extern int do_get_thread_area(struct task_struct *p, int idx,
 			      struct user_desc __user *info);
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 077904c8b70d..cc79eff4a1ad 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -334,6 +334,9 @@ static inline void user_single_step_siginfo(struct task_struct *tsk,
  * calling arch_ptrace_stop() when it would be superfluous.  For example,
  * if the thread has not been back to user mode since the last stop, the
  * thread state might indicate that nothing needs to be done.
+ *
+ * This is guaranteed to be invoked once before a task stops for ptrace and
+ * may include arch-specific operations necessary prior to a ptrace stop.
  */
 #define arch_ptrace_stop_needed(code, info)	(0)
 #endif
-- 
2.0.0


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

* [PATCH 3.12 054/170] lz4: add overrun checks to lz4_uncompress_unknownoutputsize()
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (52 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 053/170] ptrace,x86: force IRET path after a ptrace_stop() Jiri Slaby
@ 2014-07-18 12:10 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 055/170] Documentation/SubmittingPatches: describe the Fixes: tag Jiri Slaby
                   ` (116 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:10 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Greg Kroah-Hartman, Don A. Bailey, Jiri Slaby

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

commit 4a3a99045177369700c60d074c0e525e8093b0fc upstream.

Jan points out that I forgot to make the needed fixes to the
lz4_uncompress_unknownoutputsize() function to mirror the changes done
in lz4_decompress() with regards to potential pointer overflows.

The only in-kernel user of this function is the zram code, which only
takes data from a valid compressed buffer that it made itself, so it's
not a big issue.  But due to external kernel modules using this
function, it's better to be safe here.

Reported-by: Jan Beulich <JBeulich@suse.com>
Cc: "Don A. Bailey" <donb@securitymouse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 lib/lz4/lz4_decompress.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c
index b74da447e81e..7a85967060a5 100644
--- a/lib/lz4/lz4_decompress.c
+++ b/lib/lz4/lz4_decompress.c
@@ -192,6 +192,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
 			int s = 255;
 			while ((ip < iend) && (s == 255)) {
 				s = *ip++;
+				if (unlikely(length > (size_t)(length + s)))
+					goto _output_error;
 				length += s;
 			}
 		}
@@ -232,6 +234,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
 		if (length == ML_MASK) {
 			while (ip < iend) {
 				int s = *ip++;
+				if (unlikely(length > (size_t)(length + s)))
+					goto _output_error;
 				length += s;
 				if (s == 255)
 					continue;
@@ -284,7 +288,7 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
 
 	/* write overflow error detected */
 _output_error:
-	return (int) (-(((char *) ip) - source));
+	return -1;
 }
 
 int lz4_decompress(const unsigned char *src, size_t *src_len,
-- 
2.0.0


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

* [PATCH 3.12 055/170] Documentation/SubmittingPatches: describe the Fixes: tag
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (53 preceding siblings ...)
  2014-07-18 12:10 ` [PATCH 3.12 054/170] lz4: add overrun checks to lz4_uncompress_unknownoutputsize() Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 056/170] tracing: Try again for saved cmdline if failed due to locking Jiri Slaby
                   ` (115 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Jacob Keller, Jeff Kirsher, Randy Dunlap,
	Andrew Morton, Linus Torvalds, Jiri Slaby

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

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

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

commit 8401aa1f59975c03eeebd3ac6d264cbdfe9af5de upstream.

Update the SubmittingPatches process to include howto about the new
'Fixes:' tag to be used when a patch fixes an issue in a previous commit
(found by git-bisect for example).

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: Randy Dunlap <rdunlap@infradead.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>
---
 Documentation/SubmittingPatches | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index 26b1e31d5a13..1ec219a14904 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -119,6 +119,20 @@ Example:
 	platform_set_drvdata(), but left the variable "dev" unused,
 	delete it.
 
+If your patch fixes a bug in a specific commit, e.g. you found an issue using
+git-bisect, please use the 'Fixes:' tag with the first 12 characters of the
+SHA-1 ID, and the one line summary.
+Example:
+
+	Fixes: e21d2170f366 ("video: remove unnecessary platform_set_drvdata()")
+
+The following git-config settings can be used to add a pretty format for
+outputting the above style in the git log or git show commands
+
+	[core]
+		abbrev = 12
+	[pretty]
+		fixes = Fixes: %h (\"%s\")
 
 3) Separate your changes.
 
@@ -430,7 +444,7 @@ person it names.  This tag documents that potentially interested parties
 have been included in the discussion
 
 
-14) Using Reported-by:, Tested-by:, Reviewed-by: and Suggested-by:
+14) Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes:
 
 If this patch fixes a problem reported by somebody else, consider adding a
 Reported-by: tag to credit the reporter for their contribution.  Please
@@ -485,6 +499,12 @@ idea was not posted in a public forum. That said, if we diligently credit our
 idea reporters, they will, hopefully, be inspired to help us again in the
 future.
 
+A Fixes: tag indicates that the patch fixes an issue in a previous commit. It
+is used to make it easy to determine where a bug originated, which can help
+review a bug fix. This tag also assists the stable kernel team in determining
+which stable kernel versions should receive your fix. This is the preferred
+method for indicating a bug fixed by the patch. See #2 above for more details.
+
 
 15) The canonical patch format
 
-- 
2.0.0


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

* [PATCH 3.12 056/170] tracing: Try again for saved cmdline if failed due to locking
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (54 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 055/170] Documentation/SubmittingPatches: describe the Fixes: tag Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 057/170] tracing: Fix syscall_*regfunc() vs copy_process() race Jiri Slaby
                   ` (114 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Steven Rostedt (Red Hat), Jiri Slaby

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

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

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

commit 379cfdac37923653c9d4242d10052378b7563005 upstream.

In order to prevent the saved cmdline cache from being filled when
tracing is not active, the comms are only recorded after a trace event
is recorded.

The problem is, a comm can fail to be recorded if the trace_cmdline_lock
is held. That lock is taken via a trylock to allow it to happen from
any context (including NMI). If the lock fails to be taken, the comm
is skipped. No big deal, as we will try again later.

But! Because of the code that was added to only record after an event,
we may not try again later as the recording is made as a oneshot per
event per CPU.

Only disable the recording of the comm if the comm is actually recorded.

Fixes: 7ffbd48d5cab "tracing: Cache comms only after an event occurred"
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/trace/trace.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 138077b1a607..24a74162e76f 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1417,12 +1417,12 @@ static void tracing_stop_tr(struct trace_array *tr)
 
 void trace_stop_cmdline_recording(void);
 
-static void trace_save_cmdline(struct task_struct *tsk)
+static int trace_save_cmdline(struct task_struct *tsk)
 {
 	unsigned pid, idx;
 
 	if (!tsk->pid || unlikely(tsk->pid > PID_MAX_DEFAULT))
-		return;
+		return 0;
 
 	/*
 	 * It's not the end of the world if we don't get
@@ -1431,7 +1431,7 @@ static void trace_save_cmdline(struct task_struct *tsk)
 	 * so if we miss here, then better luck next time.
 	 */
 	if (!arch_spin_trylock(&trace_cmdline_lock))
-		return;
+		return 0;
 
 	idx = map_pid_to_cmdline[tsk->pid];
 	if (idx == NO_CMDLINE_MAP) {
@@ -1456,6 +1456,8 @@ static void trace_save_cmdline(struct task_struct *tsk)
 	memcpy(&saved_cmdlines[idx], tsk->comm, TASK_COMM_LEN);
 
 	arch_spin_unlock(&trace_cmdline_lock);
+
+	return 1;
 }
 
 void trace_find_cmdline(int pid, char comm[])
@@ -1497,9 +1499,8 @@ void tracing_record_cmdline(struct task_struct *tsk)
 	if (!__this_cpu_read(trace_cmdline_save))
 		return;
 
-	__this_cpu_write(trace_cmdline_save, false);
-
-	trace_save_cmdline(tsk);
+	if (trace_save_cmdline(tsk))
+		__this_cpu_write(trace_cmdline_save, false);
 }
 
 void
-- 
2.0.0


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

* [PATCH 3.12 057/170] tracing: Fix syscall_*regfunc() vs copy_process() race
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (55 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 056/170] tracing: Try again for saved cmdline if failed due to locking Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 058/170] ALSA: usb-audio: Fix races at disconnection and PCM closing Jiri Slaby
                   ` (113 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Oleg Nesterov, Steven Rostedt, Jiri Slaby

From: Oleg Nesterov <oleg@redhat.com>

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

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

commit 4af4206be2bd1933cae20c2b6fb2058dbc887f7c upstream.

syscall_regfunc() and syscall_unregfunc() should set/clear
TIF_SYSCALL_TRACEPOINT system-wide, but do_each_thread() can race
with copy_process() and miss the new child which was not added to
the process/thread lists yet.

Change copy_process() to update the child's TIF_SYSCALL_TRACEPOINT
under tasklist.

Link: http://lkml.kernel.org/p/20140413185854.GB20668@redhat.com

Fixes: a871bd33a6c0 "tracing: Add syscall tracepoints"
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 include/trace/syscall.h | 15 +++++++++++++++
 kernel/fork.c           |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/include/trace/syscall.h b/include/trace/syscall.h
index fed853f3d7aa..9674145e2f6a 100644
--- a/include/trace/syscall.h
+++ b/include/trace/syscall.h
@@ -4,6 +4,7 @@
 #include <linux/tracepoint.h>
 #include <linux/unistd.h>
 #include <linux/ftrace_event.h>
+#include <linux/thread_info.h>
 
 #include <asm/ptrace.h>
 
@@ -32,4 +33,18 @@ struct syscall_metadata {
 	struct ftrace_event_call *exit_event;
 };
 
+#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
+static inline void syscall_tracepoint_update(struct task_struct *p)
+{
+	if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
+		set_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
+	else
+		clear_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
+}
+#else
+static inline void syscall_tracepoint_update(struct task_struct *p)
+{
+}
+#endif
+
 #endif /* _TRACE_SYSCALL_H */
diff --git a/kernel/fork.c b/kernel/fork.c
index c873bd081e09..143962949bed 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1490,7 +1490,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,
 
 	total_forks++;
 	spin_unlock(&current->sighand->siglock);
+	syscall_tracepoint_update(p);
 	write_unlock_irq(&tasklist_lock);
+
 	proc_fork_connector(p);
 	cgroup_post_fork(p);
 	if (clone_flags & CLONE_THREAD)
-- 
2.0.0


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

* [PATCH 3.12 058/170] ALSA: usb-audio: Fix races at disconnection and PCM closing
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (56 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 057/170] tracing: Fix syscall_*regfunc() vs copy_process() race Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 059/170] ibmvscsi: Abort init sequence during error recovery Jiri Slaby
                   ` (112 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 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 92a586bdc06de6629dae1b357dac221253f55ff8 upstream.

When a USB-audio device is disconnected while PCM is still running, we
still see some race: the disconnect callback calls
snd_usb_endpoint_free() that calls release_urbs() and then kfree()
while a PCM stream would be closed at the same time and calls
stop_endpoints() that leads to wait_clear_urbs().  That is, the EP
object might be deallocated while a PCM stream is syncing with
wait_clear_urbs() with the same EP.

Basically calling multiple wait_clear_urbs() would work fine, also
calling wait_clear_urbs() and release_urbs() would work, too, as
wait_clear_urbs() just reads some fields in ep.  The problem is the
succeeding kfree() in snd_pcm_endpoint_free().

This patch moves out the EP deallocation into the later point, the
destructor callback.  At this stage, all PCMs must have been already
closed, so it's safe to free the objects.

Reported-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/usb/card.c     | 13 ++++++++++---
 sound/usb/endpoint.c | 17 ++++++++++++++---
 sound/usb/endpoint.h |  1 +
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/sound/usb/card.c b/sound/usb/card.c
index 64952e2d3ed1..fda227e3bbac 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -307,6 +307,11 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
 
 static int snd_usb_audio_free(struct snd_usb_audio *chip)
 {
+	struct list_head *p, *n;
+
+	list_for_each_safe(p, n, &chip->ep_list)
+		snd_usb_endpoint_free(p);
+
 	mutex_destroy(&chip->mutex);
 	kfree(chip);
 	return 0;
@@ -583,7 +588,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
 				     struct snd_usb_audio *chip)
 {
 	struct snd_card *card;
-	struct list_head *p, *n;
+	struct list_head *p;
 
 	if (chip == (void *)-1L)
 		return;
@@ -596,14 +601,16 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
 	mutex_lock(&register_mutex);
 	chip->num_interfaces--;
 	if (chip->num_interfaces <= 0) {
+		struct snd_usb_endpoint *ep;
+
 		snd_card_disconnect(card);
 		/* release the pcm resources */
 		list_for_each(p, &chip->pcm_list) {
 			snd_usb_stream_disconnect(p);
 		}
 		/* release the endpoint resources */
-		list_for_each_safe(p, n, &chip->ep_list) {
-			snd_usb_endpoint_free(p);
+		list_for_each_entry(ep, &chip->ep_list, list) {
+			snd_usb_endpoint_release(ep);
 		}
 		/* release the midi resources */
 		list_for_each(p, &chip->midi_list) {
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index ba106c6c2d3a..b0a0f2028319 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -960,19 +960,30 @@ int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep)
 }
 
 /**
+ * snd_usb_endpoint_release: Tear down an snd_usb_endpoint
+ *
+ * @ep: the endpoint to release
+ *
+ * This function does not care for the endpoint's use count but will tear
+ * down all the streaming URBs immediately.
+ */
+void snd_usb_endpoint_release(struct snd_usb_endpoint *ep)
+{
+	release_urbs(ep, 1);
+}
+
+/**
  * snd_usb_endpoint_free: Free the resources of an snd_usb_endpoint
  *
  * @ep: the list header of the endpoint to free
  *
- * This function does not care for the endpoint's use count but will tear
- * down all the streaming URBs immediately and free all resources.
+ * This free all resources of the given ep.
  */
 void snd_usb_endpoint_free(struct list_head *head)
 {
 	struct snd_usb_endpoint *ep;
 
 	ep = list_entry(head, struct snd_usb_endpoint, list);
-	release_urbs(ep, 1);
 	kfree(ep);
 }
 
diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h
index 2287adf5ca59..fe65a38ba387 100644
--- a/sound/usb/endpoint.h
+++ b/sound/usb/endpoint.h
@@ -21,6 +21,7 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep);
 void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep);
 int  snd_usb_endpoint_activate(struct snd_usb_endpoint *ep);
 int  snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep);
+void snd_usb_endpoint_release(struct snd_usb_endpoint *ep);
 void snd_usb_endpoint_free(struct list_head *head);
 
 int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep);
-- 
2.0.0


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

* [PATCH 3.12 059/170] ibmvscsi: Abort init sequence during error recovery
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (57 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 058/170] ALSA: usb-audio: Fix races at disconnection and PCM closing Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 060/170] ibmvscsi: Add memory barriers for send / receive Jiri Slaby
                   ` (111 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Brian King, Christoph Hellwig, Jiri Slaby

From: Brian King <brking@linux.vnet.ibm.com>

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

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

commit 9ee755974bea2f9880e517ec985dc9dede1b3a36 upstream.

If a CRQ reset is triggered for some reason while in the middle
of performing VSCSI adapter initialization, we don't want to
call the done function for the initialization MAD commands as
this will only result in two threads attempting initialization
at the same time, resulting in failures.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Acked-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/ibmvscsi/ibmvscsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index fa764406df68..c3d4991411b2 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -797,7 +797,8 @@ static void purge_requests(struct ibmvscsi_host_data *hostdata, int error_code)
 				       evt->hostdata->dev);
 			if (evt->cmnd_done)
 				evt->cmnd_done(evt->cmnd);
-		} else if (evt->done)
+		} else if (evt->done && evt->crq.format != VIOSRP_MAD_FORMAT &&
+			   evt->iu.srp.login_req.opcode != SRP_LOGIN_REQ)
 			evt->done(evt);
 		free_event_struct(&evt->hostdata->pool, evt);
 		spin_lock_irqsave(hostdata->host->host_lock, flags);
-- 
2.0.0


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

* [PATCH 3.12 060/170] ibmvscsi: Add memory barriers for send / receive
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (58 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 059/170] ibmvscsi: Abort init sequence during error recovery Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 061/170] virtio-scsi: avoid cancelling uninitialized work items Jiri Slaby
                   ` (110 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Brian King, Christoph Hellwig, Jiri Slaby

From: Brian King <brking@linux.vnet.ibm.com>

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

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

commit 7114aae02742d6b5c5a0d39a41deb61d415d3717 upstream.

Add a memory barrier prior to sending a new command to the VIOS
to ensure the VIOS does not receive stale data in the command buffer.
Also add a memory barrier when processing the CRQ for completed commands.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Acked-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/ibmvscsi/ibmvscsi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index c3d4991411b2..c5bb0e0a36b9 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -185,6 +185,11 @@ static struct viosrp_crq *crq_queue_next_crq(struct crq_queue *queue)
 	if (crq->valid & 0x80) {
 		if (++queue->cur == queue->size)
 			queue->cur = 0;
+
+		/* Ensure the read of the valid bit occurs before reading any
+		 * other bits of the CRQ entry
+		 */
+		rmb();
 	} else
 		crq = NULL;
 	spin_unlock_irqrestore(&queue->lock, flags);
@@ -203,6 +208,11 @@ static int ibmvscsi_send_crq(struct ibmvscsi_host_data *hostdata,
 {
 	struct vio_dev *vdev = to_vio_dev(hostdata->dev);
 
+	/*
+	 * Ensure the command buffer is flushed to memory before handing it
+	 * over to the VIOS to prevent it from fetching any stale data.
+	 */
+	mb();
 	return plpar_hcall_norets(H_SEND_CRQ, vdev->unit_address, word1, word2);
 }
 
-- 
2.0.0


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

* [PATCH 3.12 061/170] virtio-scsi: avoid cancelling uninitialized work items
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (59 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 060/170] ibmvscsi: Add memory barriers for send / receive Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 062/170] scsi_error: fix invalid setting of host byte Jiri Slaby
                   ` (109 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Paolo Bonzini, Christoph Hellwig, Jiri Slaby

From: Paolo Bonzini <pbonzini@redhat.com>

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

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

commit cdda0e5acbb78f7b777049f8c27899e5c5bb368f upstream.

Calling the workqueue interface on uninitialized work items isn't a
good idea even if they're zeroed. It's not failing catastrophically only
through happy accidents.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/virtio_scsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 95a5d73e675c..57c39e1e6681 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -288,6 +288,8 @@ static void virtscsi_ctrl_done(struct virtqueue *vq)
 	virtscsi_vq_done(vscsi, &vscsi->ctrl_vq, virtscsi_complete_free);
 };
 
+static void virtscsi_handle_event(struct work_struct *work);
+
 static int virtscsi_kick_event(struct virtio_scsi *vscsi,
 			       struct virtio_scsi_event_node *event_node)
 {
@@ -295,6 +297,7 @@ static int virtscsi_kick_event(struct virtio_scsi *vscsi,
 	struct scatterlist sg;
 	unsigned long flags;
 
+	INIT_WORK(&event_node->work, virtscsi_handle_event);
 	sg_init_one(&sg, &event_node->event, sizeof(struct virtio_scsi_event));
 
 	spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags);
@@ -412,7 +415,6 @@ static void virtscsi_complete_event(struct virtio_scsi *vscsi, void *buf)
 {
 	struct virtio_scsi_event_node *event_node = buf;
 
-	INIT_WORK(&event_node->work, virtscsi_handle_event);
 	schedule_work(&event_node->work);
 }
 
-- 
2.0.0


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

* [PATCH 3.12 062/170] scsi_error: fix invalid setting of host byte
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (60 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 061/170] virtio-scsi: avoid cancelling uninitialized work items Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 063/170] virtio-scsi: fix various bad behavior on aborted requests Jiri Slaby
                   ` (108 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Ulrich Obergfell, Paolo Bonzini, Christoph Hellwig,
	Jiri Slaby

From: Ulrich Obergfell <uobergfe@redhat.com>

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

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

commit 8922a908908ff947f1f211e07e2e97f1169ad3cb upstream.

After scsi_try_to_abort_cmd returns, the eh_abort_handler may have
already found that the command has completed in the device, causing
the host_byte to be nonzero (e.g. it could be DID_ABORT).  When
this happens, ORing DID_TIME_OUT into the host byte will corrupt
the result field and initiate an unwanted command retry.

Fix this by using set_host_byte instead, following the model of
commit 2082ebc45af9c9c648383b8cde0dc1948eadbf31.

Signed-off-by: Ulrich Obergfell <uobergfe@redhat.com>
[Fix all instances according to review comments. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/scsi_error.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 83e591b60193..9ba3642cb19e 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -143,7 +143,7 @@ enum blk_eh_timer_return scsi_times_out(struct request *req)
 	else if (host->hostt->eh_timed_out)
 		rtn = host->hostt->eh_timed_out(scmd);
 
-	scmd->result |= DID_TIME_OUT << 16;
+	set_host_byte(scmd, DID_TIME_OUT);
 
 	if (unlikely(rtn == BLK_EH_NOT_HANDLED &&
 		     !scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD)))
-- 
2.0.0


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

* [PATCH 3.12 063/170] virtio-scsi: fix various bad behavior on aborted requests
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (61 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 062/170] scsi_error: fix invalid setting of host byte Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 064/170] xhci: correct burst count field for isoc transfers on 1.0 xhci hosts Jiri Slaby
                   ` (107 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Paolo Bonzini, Christoph Hellwig, Jiri Slaby

From: Paolo Bonzini <pbonzini@redhat.com>

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

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

commit 8faeb529b2dabb9df691d614dda18910a43d05c9 upstream.

Even though the virtio-scsi spec guarantees that all requests related
to the TMF will have been completed by the time the TMF itself completes,
the request queue's callback might not have run yet.  This causes requests
to be completed more than once, and as a result triggers a variety of
BUGs or oopses.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Venkatesh Srinivas <venkateshs@google.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/virtio_scsi.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 57c39e1e6681..11f5326f449f 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -270,6 +270,16 @@ static void virtscsi_req_done(struct virtqueue *vq)
 	virtscsi_vq_done(vscsi, req_vq, virtscsi_complete_cmd);
 };
 
+static void virtscsi_poll_requests(struct virtio_scsi *vscsi)
+{
+	int i, num_vqs;
+
+	num_vqs = vscsi->num_queues;
+	for (i = 0; i < num_vqs; i++)
+		virtscsi_vq_done(vscsi, &vscsi->req_vqs[i],
+				 virtscsi_complete_cmd);
+}
+
 static void virtscsi_complete_free(struct virtio_scsi *vscsi, void *buf)
 {
 	struct virtio_scsi_cmd *cmd = buf;
@@ -604,6 +614,18 @@ static int virtscsi_tmf(struct virtio_scsi *vscsi, struct virtio_scsi_cmd *cmd)
 	    cmd->resp.tmf.response == VIRTIO_SCSI_S_FUNCTION_SUCCEEDED)
 		ret = SUCCESS;
 
+	/*
+	 * The spec guarantees that all requests related to the TMF have
+	 * been completed, but the callback might not have run yet if
+	 * we're using independent interrupts (e.g. MSI).  Poll the
+	 * virtqueues once.
+	 *
+	 * In the abort case, sc->scsi_done will do nothing, because
+	 * the block layer must have detected a timeout and as a result
+	 * REQ_ATOM_COMPLETE has been set.
+	 */
+	virtscsi_poll_requests(vscsi);
+
 out:
 	mempool_free(cmd, virtscsi_cmd_pool);
 	return ret;
-- 
2.0.0


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

* [PATCH 3.12 064/170] xhci: correct burst count field for isoc transfers on 1.0 xhci hosts
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (62 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 063/170] virtio-scsi: fix various bad behavior on aborted requests Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 065/170] xhci: Fix runtime suspended xhci from blocking system suspend Jiri Slaby
                   ` (106 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 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 3213b151387df0b95f4eada104f68eb1c1409cb3 upstream.

The transfer burst count (TBC) field in xhci 1.0 hosts should be set
to the number of bursts needed to transfer all packets in a isoc TD.
Supported values are 0-2 (1 to 3 bursts per service interval).

Formula for TBC calculation is given in xhci spec section 4.11.2.3:
TBC = roundup( Transfer Descriptor Packet Count / Max Burst Size +1 ) - 1

This patch should be applied to stable kernels since 3.0 that contain
the commit 5cd43e33b9519143f06f507dd7cbee6b7a621885
"xhci 1.0: Set transfer burst count field."

Suggested-by: ShiChun Ma <masc2008@qq.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/host/xhci-ring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 1dbfb52dbcd6..6118e292d5df 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -3633,7 +3633,7 @@ static unsigned int xhci_get_burst_count(struct xhci_hcd *xhci,
 		return 0;
 
 	max_burst = urb->ep->ss_ep_comp.bMaxBurst;
-	return roundup(total_packet_count, max_burst + 1) - 1;
+	return DIV_ROUND_UP(total_packet_count, max_burst + 1) - 1;
 }
 
 /*
-- 
2.0.0


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

* [PATCH 3.12 065/170] xhci: Fix runtime suspended xhci from blocking system suspend.
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (63 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 064/170] xhci: correct burst count field for isoc transfers on 1.0 xhci hosts Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 066/170] USB: option: add device ID for SpeedUp SU9800 usb 3g modem Jiri Slaby
                   ` (105 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Wang, Yu, Mathias Nyman, Jiri Slaby

From: "Wang, Yu" <yu.y.wang@intel.com>

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

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

commit d6236f6d1d885aa19d1cd7317346fe795227a3cc upstream.

The system suspend flow as following:
1, Freeze all user processes and kenrel threads.

2, Try to suspend all devices.

2.1, If pci device is in RPM suspended state, then pci driver will try
to resume it to RPM active state in the prepare stage.

2.2, xhci_resume function calls usb_hcd_resume_root_hub to queue two
workqueue items to resume usb2&usb3 roothub devices.

2.3, Call suspend callbacks of devices.

2.3.1, All suspend callbacks of all hcd's children, including
roothub devices are called.

2.3.2, Finally, hcd_pci_suspend callback is called.

Due to workqueue threads were already frozen in step 1, the workqueue
items can't be scheduled, and the roothub devices can't be resumed in
this flow. The HCD_FLAG_WAKEUP_PENDING flag which is set in
usb_hcd_resume_root_hub won't be cleared. Finally,
hcd_pci_suspend will return -EBUSY, and system suspend fails.

The reason why this issue doesn't show up very often is due to that
choose_wakeup will be called in step 2.3.1. In step 2.3.1, if
udev->do_remote_wakeup is not equal to device_may_wakeup(&udev->dev), then
udev will resume to RPM active for changing the wakeup settings. This
has been a lucky hit which hides this issue.

For some special xHCI controllers which have no USB2 port, then roothub
will not match hub driver due to probe failed. Then its
do_remote_wakeup will be set to zero, and we won't be as lucky.

xhci driver doesn't need to resume roothub devices everytime like in
the above case. It's only needed when there are pending event TRBs.

This patch should be back-ported to kernels as old as 3.2, that
contains the commit f69e3120df82391a0ee8118e0a156239a06b2afb
"USB: XHCI: resume root hubs when the controller resumes"

Signed-off-by: Wang, Yu <yu.y.wang@intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
[use readl() instead of removed xhci_readl(), reword commit message -Mathias]
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/host/xhci.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 01aa4c9fa558..e3d12f164430 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -926,7 +926,7 @@ int xhci_suspend(struct xhci_hcd *xhci)
  */
 int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 {
-	u32			command, temp = 0;
+	u32			command, temp = 0, status;
 	struct usb_hcd		*hcd = xhci_to_hcd(xhci);
 	struct usb_hcd		*secondary_hcd;
 	int			retval = 0;
@@ -1045,8 +1045,12 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 
  done:
 	if (retval == 0) {
-		usb_hcd_resume_root_hub(hcd);
-		usb_hcd_resume_root_hub(xhci->shared_hcd);
+		/* Resume root hubs only when have pending events. */
+		status = readl(&xhci->op_regs->status);
+		if (status & STS_EINT) {
+			usb_hcd_resume_root_hub(hcd);
+			usb_hcd_resume_root_hub(xhci->shared_hcd);
+		}
 	}
 
 	/*
-- 
2.0.0


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

* [PATCH 3.12 066/170] USB: option: add device ID for SpeedUp SU9800 usb 3g modem
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (64 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 065/170] xhci: Fix runtime suspended xhci from blocking system suspend Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 067/170] usb: option: add/modify Olivetti Olicard modems Jiri Slaby
                   ` (104 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Oliver Neukum, Johan Hovold, Jiri Slaby

From: Oliver Neukum <oneukum@suse.de>

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

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

commit 1cab4c68e339086cdaff7535848e878e8f261fca upstream.

Reported by Alif Mubarak Ahmad:

This device vendor and product id is 1c9e:9800
It is working as serial interface with generic usbserial driver.
I thought it is more suitable to use usbserial option driver, which has
better capability distinguishing between modem serial interface and
micro sd storage interface.

[ johan: style changes ]

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Tested-by: Alif Mubarak Ahmad <alive4ever@live.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/option.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 70ede84f4f6b..909bb77544b5 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -352,6 +352,9 @@ static void option_instat_callback(struct urb *urb);
 /* Zoom */
 #define ZOOM_PRODUCT_4597			0x9607
 
+/* SpeedUp SU9800 usb 3g modem */
+#define SPEEDUP_PRODUCT_SU9800			0x9800
+
 /* Haier products */
 #define HAIER_VENDOR_ID				0x201e
 #define HAIER_PRODUCT_CE100			0x2009
@@ -1577,6 +1580,7 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
   	  .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
   	},
+	{ USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, SPEEDUP_PRODUCT_SU9800, 0xff) },
 	{ USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) },
 	{ USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) },
 	{ USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) },
-- 
2.0.0


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

* [PATCH 3.12 067/170] usb: option: add/modify Olivetti Olicard modems
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (65 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 066/170] USB: option: add device ID for SpeedUp SU9800 usb 3g modem Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 068/170] usb: musb: ux500: don't propagate the OF node Jiri Slaby
                   ` (103 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Bjørn Mork, Johan Hovold, Jiri Slaby

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

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

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

commit b0ebef36e93703e59003ad6a1a20227e47714417 upstream.

Adding a couple of Olivetti modems and blacklisting the net
function on a couple which are already supported.

Reported-by: Lars Melin <larsm17@gmail.com>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/option.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 909bb77544b5..e25e8ca09fe2 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -375,8 +375,12 @@ static void option_instat_callback(struct urb *urb);
 /* Olivetti products */
 #define OLIVETTI_VENDOR_ID			0x0b3c
 #define OLIVETTI_PRODUCT_OLICARD100		0xc000
+#define OLIVETTI_PRODUCT_OLICARD120		0xc001
+#define OLIVETTI_PRODUCT_OLICARD140		0xc002
 #define OLIVETTI_PRODUCT_OLICARD145		0xc003
+#define OLIVETTI_PRODUCT_OLICARD155		0xc004
 #define OLIVETTI_PRODUCT_OLICARD200		0xc005
+#define OLIVETTI_PRODUCT_OLICARD160		0xc00a
 #define OLIVETTI_PRODUCT_OLICARD500		0xc00b
 
 /* Celot products */
@@ -1615,15 +1619,21 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) },
 	{ USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */
 	{ USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
-
-	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) },
+	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100),
+		.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120),
+		.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD140),
+		.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) },
+	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD155),
+		.driver_info = (kernel_ulong_t)&net_intf6_blacklist },
 	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200),
-		.driver_info = (kernel_ulong_t)&net_intf6_blacklist
-	},
+		.driver_info = (kernel_ulong_t)&net_intf6_blacklist },
+	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD160),
+		.driver_info = (kernel_ulong_t)&net_intf6_blacklist },
 	{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD500),
-		.driver_info = (kernel_ulong_t)&net_intf4_blacklist
-	},
+		.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
 	{ USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/
 	{ USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) },
-- 
2.0.0


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

* [PATCH 3.12 068/170] usb: musb: ux500: don't propagate the OF node
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (66 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 067/170] usb: option: add/modify Olivetti Olicard modems Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 069/170] usb: musb: Ensure that cppi41 timer gets armed on premature DMA TX irq Jiri Slaby
                   ` (102 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Linus Walleij, Arnd Bergmann, Felipe Balbi, Jiri Slaby

From: Linus Walleij <linus.walleij@linaro.org>

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

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

commit 82363cf2eeafeea6ba88849f5e2febdc8a05943f upstream.

There is a regression in the upcoming v3.16-rc1, that is caused
by a problem that has been around for a while but now finally
hangs the system. The bootcrawl looks like this:

pinctrl-nomadik soc:pinctrl: pin GPIO256_AF28 already
requested by a03e0000.usb_per5; cannot claim for musb-hdrc.0.auto
pinctrl-nomadik soc:pinctrl: pin-256 (musb-hdrc.0.auto) status -22
pinctrl-nomadik soc:pinctrl: could not request pin 256
(GPIO256_AF28) from group usb_a_1  on device pinctrl-nomadik
musb-hdrc musb-hdrc.0.auto: Error applying setting, reverse
things back
HS USB OTG: no transceiver configured
musb-hdrc musb-hdrc.0.auto: musb_init_controller failed
with status -517
platform musb-hdrc.0.auto: Driver musb-hdrc requests
probe deferral
(...)

The ux500 MUSB driver propagates the OF node to the dynamically
created musb-hdrc device, which is incorrect as it makes the OF
core believe there are two devices spun from the very same
DT node, which confuses other parts of the device core, notably
the pin control subsystem, which will try to apply all the pin
control settings also to the HDRC device as it gets
instantiated. (The OMAP2430 for example, does not set the
of_node member.)

Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/musb/ux500.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index 59256b12f746..8264256271f8 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -275,7 +275,6 @@ static int ux500_probe(struct platform_device *pdev)
 	musb->dev.parent		= &pdev->dev;
 	musb->dev.dma_mask		= &pdev->dev.coherent_dma_mask;
 	musb->dev.coherent_dma_mask	= pdev->dev.coherent_dma_mask;
-	musb->dev.of_node		= pdev->dev.of_node;
 
 	glue->dev			= &pdev->dev;
 	glue->musb			= musb;
-- 
2.0.0


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

* [PATCH 3.12 069/170] usb: musb: Ensure that cppi41 timer gets armed on premature DMA TX irq
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (67 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 068/170] usb: musb: ux500: don't propagate the OF node Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 070/170] usb: musb: Fix panic upon musb_am335x module removal Jiri Slaby
                   ` (101 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Thomas Gleixner, Felipe Balbi, Jiri Slaby

From: Thomas Gleixner <tglx@linutronix.de>

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

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

commit c58d80f523ffc15ef4d062fc7aeb03793fe39701 upstream.

Some TI chips raise the DMA complete interrupt before the actual
transfer has been completed. The code tries to busy wait for a few
microseconds and if that fails it arms an hrtimer to recheck. So far
so good, but that has the following issue:

CPU 0					CPU1

start_next_transfer(RQ1);

DMA interrupt
  if (premature_irq(RQ1))
    if (!hrtimer_active(timer))
       hrtimer_start(timer);

hrtimer expires
  timer->state = CALLBACK_RUNNING;
  timer->fn()
    cppi41_recheck_tx_req()
      complete_request(RQ1);
      if (requests_pending())
        start_next_transfer(RQ2);

					DMA interrupt
					  if (premature_irq(RQ2))
					    if (!hrtimer_active(timer))
					       hrtimer_start(timer);
  timer->state = INACTIVE;

The premature interrupt of request2 on CPU1 does not arm the timer and
therefor the request completion never happens because it checks for
!hrtimer_active(). hrtimer_active() evaluates:

  timer->state != HRTIMER_STATE_INACTIVE

which of course evaluates to true in the above case as timer->state is
CALLBACK_RUNNING.

That's clearly documented:

 * A timer is active, when it is enqueued into the rbtree or the
 * callback function is running or it's in the state of being migrated
 * to another cpu.

But that's not what the code wants to check. The code wants to check
whether the timer is queued, i.e. whether its armed and waiting for
expiry.

We have a helper function for this: hrtimer_is_queued(). This
evaluates:

  timer->state & HRTIMER_STATE_QUEUED

So in the above case this evaluates to false and therefor forces the
DMA interrupt on CPU1 to call hrtimer_start().

Use hrtimer_is_queued() instead of hrtimer_active() and evrything is
good.

Reported-by: Torben Hohn <torbenh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/musb/musb_cppi41.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
index 0c593afc3185..cc319305c022 100644
--- a/drivers/usb/musb/musb_cppi41.c
+++ b/drivers/usb/musb/musb_cppi41.c
@@ -266,7 +266,7 @@ static void cppi41_dma_callback(void *private_data)
 		}
 		list_add_tail(&cppi41_channel->tx_check,
 				&controller->early_tx_list);
-		if (!hrtimer_active(&controller->early_tx)) {
+		if (!hrtimer_is_queued(&controller->early_tx)) {
 			hrtimer_start_range_ns(&controller->early_tx,
 				ktime_set(0, 140 * NSEC_PER_USEC),
 				40 * NSEC_PER_USEC,
-- 
2.0.0


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

* [PATCH 3.12 070/170] usb: musb: Fix panic upon musb_am335x module removal
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (68 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 069/170] usb: musb: Ensure that cppi41 timer gets armed on premature DMA TX irq Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 071/170] usb: chipidea: udc: delete td from req's td list at ep_dequeue Jiri Slaby
                   ` (100 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ezequiel Garcia, Felipe Balbi, Jiri Slaby

From: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>

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

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

commit 7adb5c876e9c0677078a1e1094c6eafd29c30b74 upstream.

At probe time, the musb_am335x driver register its childs by
calling of_platform_populate(), which registers all childs in
the devicetree hierarchy recursively.

On the other side, the driver's remove() function uses of_device_unregister()
to remove each child of musb_am335x's.

However, when musb_dsps is loaded, its devices are attached to the musb_am335x
device as musb_am335x childs. Hence, musb_am335x remove() will attempt to
unregister the devices registered by musb_dsps, which produces a kernel panic.

In other words, the childs in the "struct device" hierarchy are not the same
as the childs in the "devicetree" hierarchy.

Ideally, we should enforce the removal of the devices registered by
musb_am335x *only*, instead of all its child devices. However, because of the
recursive nature of of_platform_populate, this doesn't seem possible.

Therefore, as the only solution at hand, this commit disables musb_am335x
driver removal capability, preventing it from being ever removed. This was
originally suggested by Sebastian Siewior:

https://www.mail-archive.com/linux-omap@vger.kernel.org/msg104946.html

And for reference, here's the panic upon module removal:

musb-hdrc musb-hdrc.0.auto: remove, state 4
usb usb1: USB disconnect, device number 1
musb-hdrc musb-hdrc.0.auto: USB bus 1 deregistered
Unable to handle kernel NULL pointer dereference at virtual address 0000008c
pgd = de11c000
[0000008c] *pgd=9e174831, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1] ARM
Modules linked in: musb_am335x(-) musb_dsps musb_hdrc usbcore usb_common
CPU: 0 PID: 623 Comm: modprobe Not tainted 3.15.0-rc4-00001-g24efd13 #69
task: de1b7500 ti: de122000 task.ti: de122000
PC is at am335x_shutdown+0x10/0x28
LR is at am335x_shutdown+0xc/0x28
pc : [<c0327798>]    lr : [<c0327794>]    psr: a0000013
sp : de123df8  ip : 00000004  fp : 00028f00
r10: 00000000  r9 : de122000  r8 : c000e6c4
r7 : de0e3c10  r6 : de0e3800  r5 : de624010  r4 : de1ec750
r3 : de0e3810  r2 : 00000000  r1 : 00000001  r0 : 00000000
Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c5387d  Table: 9e11c019  DAC: 00000015
Process modprobe (pid: 623, stack limit = 0xde122240)
Stack: (0xde123df8 to 0xde124000)
3de0:                                                       de0e3810 bf054488
3e00: bf05444c de624010 60000013 bf043650 000012fc de624010 de0e3810 bf043a20
3e20: de0e3810 bf04b240 c0635b88 c02ca37c c02ca364 c02c8db0 de1b7500 de0e3844
3e40: de0e3810 c02c8e28 c0635b88 de02824c de0e3810 c02c884c de0e3800 de0e3810
3e60: de0e3818 c02c5b20 bf05417c de0e3800 de0e3800 c0635b88 de0f2410 c02ca838
3e80: bf05417c de0e3800 bf055438 c02ca8cc de0e3c10 bf054194 de0e3c10 c02ca37c
3ea0: c02ca364 c02c8db0 de1b7500 de0e3c44 de0e3c10 c02c8e28 c0635b88 de02824c
3ec0: de0e3c10 c02c884c de0e3c10 de0e3c10 de0e3c18 c02c5b20 de0e3c10 de0e3c10
3ee0: 00000000 bf059000 a0000013 c02c5bc0 00000000 bf05900c de0e3c10 c02c5c48
3f00: de0dd0c0 de1ec970 de0f2410 bf05929c de0f2444 bf05902c de0f2410 c02ca37c
3f20: c02ca364 c02c8db0 bf05929c de0f2410 bf05929c c02c94c8 bf05929c 00000000
3f40: 00000800 c02c8ab4 bf0592e0 c007fc40 c00dd820 6273756d 336d615f 00783533
3f60: c064a0ac de1b7500 de122000 de1b7500 c000e590 00000001 c000e6c4 c0060160
3f80: 00028e70 00028e70 00028ea4 00000081 60000010 00028e70 00028e70 00028ea4
3fa0: 00000081 c000e500 00028e70 00028e70 00028ea4 00000800 becb59f8 00027608
3fc0: 00028e70 00028e70 00028ea4 00000081 00000001 00000001 00000000 00028f00
3fe0: b6e6b6f0 becb59d4 000160e8 b6e6b6fc 60000010 00028ea4 00000000 00000000
[<c0327798>] (am335x_shutdown) from [<bf054488>] (dsps_musb_exit+0x3c/0x4c [musb_dsps])
[<bf054488>] (dsps_musb_exit [musb_dsps]) from [<bf043650>] (musb_shutdown+0x80/0x90 [musb_hdrc])
[<bf043650>] (musb_shutdown [musb_hdrc]) from [<bf043a20>] (musb_remove+0x24/0x68 [musb_hdrc])
[<bf043a20>] (musb_remove [musb_hdrc]) from [<c02ca37c>] (platform_drv_remove+0x18/0x1c)
[<c02ca37c>] (platform_drv_remove) from [<c02c8db0>] (__device_release_driver+0x70/0xc8)
[<c02c8db0>] (__device_release_driver) from [<c02c8e28>] (device_release_driver+0x20/0x2c)
[<c02c8e28>] (device_release_driver) from [<c02c884c>] (bus_remove_device+0xdc/0x10c)
[<c02c884c>] (bus_remove_device) from [<c02c5b20>] (device_del+0x104/0x198)
[<c02c5b20>] (device_del) from [<c02ca838>] (platform_device_del+0x14/0x9c)
[<c02ca838>] (platform_device_del) from [<c02ca8cc>] (platform_device_unregister+0xc/0x20)
[<c02ca8cc>] (platform_device_unregister) from [<bf054194>] (dsps_remove+0x18/0x38 [musb_dsps])
[<bf054194>] (dsps_remove [musb_dsps]) from [<c02ca37c>] (platform_drv_remove+0x18/0x1c)
[<c02ca37c>] (platform_drv_remove) from [<c02c8db0>] (__device_release_driver+0x70/0xc8)
[<c02c8db0>] (__device_release_driver) from [<c02c8e28>] (device_release_driver+0x20/0x2c)
[<c02c8e28>] (device_release_driver) from [<c02c884c>] (bus_remove_device+0xdc/0x10c)
[<c02c884c>] (bus_remove_device) from [<c02c5b20>] (device_del+0x104/0x198)
[<c02c5b20>] (device_del) from [<c02c5bc0>] (device_unregister+0xc/0x20)
[<c02c5bc0>] (device_unregister) from [<bf05900c>] (of_remove_populated_child+0xc/0x14 [musb_am335x])
[<bf05900c>] (of_remove_populated_child [musb_am335x]) from [<c02c5c48>] (device_for_each_child+0x44/0x70)
[<c02c5c48>] (device_for_each_child) from [<bf05902c>] (am335x_child_remove+0x18/0x30 [musb_am335x])
[<bf05902c>] (am335x_child_remove [musb_am335x]) from [<c02ca37c>] (platform_drv_remove+0x18/0x1c)
[<c02ca37c>] (platform_drv_remove) from [<c02c8db0>] (__device_release_driver+0x70/0xc8)
[<c02c8db0>] (__device_release_driver) from [<c02c94c8>] (driver_detach+0xb4/0xb8)
[<c02c94c8>] (driver_detach) from [<c02c8ab4>] (bus_remove_driver+0x4c/0xa0)
[<c02c8ab4>] (bus_remove_driver) from [<c007fc40>] (SyS_delete_module+0x128/0x1cc)
[<c007fc40>] (SyS_delete_module) from [<c000e500>] (ret_fast_syscall+0x0/0x48)

Fixes: 97238b35d5bb ("usb: musb: dsps: use proper child nodes")
Acked-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/musb/musb_am335x.c | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/musb/musb_am335x.c b/drivers/usb/musb/musb_am335x.c
index 41ac5b5b57ce..83b97dc409dc 100644
--- a/drivers/usb/musb/musb_am335x.c
+++ b/drivers/usb/musb/musb_am335x.c
@@ -20,21 +20,6 @@ err:
 	return ret;
 }
 
-static int of_remove_populated_child(struct device *dev, void *d)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-
-	of_device_unregister(pdev);
-	return 0;
-}
-
-static int am335x_child_remove(struct platform_device *pdev)
-{
-	device_for_each_child(&pdev->dev, NULL, of_remove_populated_child);
-	pm_runtime_disable(&pdev->dev);
-	return 0;
-}
-
 static const struct of_device_id am335x_child_of_match[] = {
 	{ .compatible = "ti,am33xx-usb" },
 	{  },
@@ -43,13 +28,17 @@ MODULE_DEVICE_TABLE(of, am335x_child_of_match);
 
 static struct platform_driver am335x_child_driver = {
 	.probe		= am335x_child_probe,
-	.remove         = am335x_child_remove,
 	.driver         = {
 		.name   = "am335x-usb-childs",
 		.of_match_table	= of_match_ptr(am335x_child_of_match),
 	},
 };
 
-module_platform_driver(am335x_child_driver);
+static int __init am335x_child_init(void)
+{
+	return platform_driver_register(&am335x_child_driver);
+}
+module_init(am335x_child_init);
+
 MODULE_DESCRIPTION("AM33xx child devices");
 MODULE_LICENSE("GPL v2");
-- 
2.0.0


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

* [PATCH 3.12 071/170] usb: chipidea: udc: delete td from req's td list at ep_dequeue
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (69 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 070/170] usb: musb: Fix panic upon musb_am335x module removal Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 072/170] USB: ftdi_sio: fix null deref at port probe Jiri Slaby
                   ` (99 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Peter Chen, Andrzej Pietrasiewicz, Jiri Slaby

From: Peter Chen <peter.chen@freescale.com>

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

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

commit e4adcff09ca39ecbcc4851d40d0f0a5458e7b77a upstream.

We need to delete un-finished td from current request's td list
at ep_dequeue API, otherwise, this non-user td will be remained
at td list before this request is freed. So if we do ep_queue->
ep_dequeue->ep_queue sequence, when the complete interrupt for
the second ep_queue comes, we search td list for this request,
the first td (added by the first ep_queue) will be handled, and
its status is still active, so we will consider the this transfer
still not be completed, but in fact, it has completed. It causes
the peripheral side considers it never receives current data for
this transfer.

We met this problem when do "Error Recovery Test - Device Configured"
test item for USBCV2 MSC test, the host has never received ACK for
the IN token for CSW due to peripheral considers it does not get this
CBW, the USBCV test log like belows:

--------------------------------------------------------------------------
INFO
Issuing BOT MSC Reset, reset should always succeed
INFO
Retrieving status on CBW endpoint
INFO
CBW endpoint status = 0x0
INFO
Retrieving status on CSW endpoint
INFO
CSW endpoint status = 0x0
INFO
Issuing required command (Test Unit Ready) to verify device has recovered
INFO
Issuing CBW (attempt #1):
INFO
|----- CBW LUN                  = 0x0
INFO
|----- CBW Flags                = 0x0
INFO
|----- CBW Data Transfer Length = 0x0
INFO
|----- CBW CDB Length           = 0x6
INFO
|----- CBW CDB-00 = 0x0
INFO
|----- CBW CDB-01 = 0x0
INFO
|----- CBW CDB-02 = 0x0
INFO
|----- CBW CDB-03 = 0x0
INFO
|----- CBW CDB-04 = 0x0
INFO
|----- CBW CDB-05 = 0x0
INFO
Issuing CSW : try 1
INFO
CSW Bulk Request timed out!
ERROR
Failed CSW phase : should have been success or stall
FAIL
(5.3.4) The CSW status value must be 0x00, 0x01, or 0x02.
ERROR
BOTCommonMSCRequest failed:  error=80004000

Cc: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/chipidea/udc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 938426ae30de..a18c2cfafe6d 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1325,6 +1325,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req)
 	struct ci_hw_ep  *hwep  = container_of(ep,  struct ci_hw_ep, ep);
 	struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req);
 	unsigned long flags;
+	struct td_node *node, *tmpnode;
 
 	if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY ||
 		hwep->ep.desc == NULL || list_empty(&hwreq->queue) ||
@@ -1335,6 +1336,12 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req)
 
 	hw_ep_flush(hwep->ci, hwep->num, hwep->dir);
 
+	list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) {
+		dma_pool_free(hwep->td_pool, node->ptr, node->dma);
+		list_del(&node->td);
+		kfree(node);
+	}
+
 	/* pop request */
 	list_del_init(&hwreq->queue);
 
-- 
2.0.0


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

* [PATCH 3.12 072/170] USB: ftdi_sio: fix null deref at port probe
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (70 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 071/170] usb: chipidea: udc: delete td from req's td list at ep_dequeue Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 073/170] usb: gadget: f_fs: fix NULL pointer dereference when there are no strings Jiri Slaby
                   ` (98 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 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 aea1ae8760314e072bf1b773521e9de5d5dda10d upstream.

Fix NULL-pointer dereference when probing an interface with no
endpoints.

These devices have two bulk endpoints per interface, but this avoids
crashing the kernel if a user forces a non-FTDI device to be probed.

Note that the iterator variable was made unsigned in order to avoid
a maybe-uninitialized compiler warning for ep_desc after the loop.

Fixes: 895f28badce9 ("USB: ftdi_sio: fix hi-speed device packet size
calculation")

Reported-by: Mike Remski <mremski@mutualink.net>
Tested-by: Mike Remski <mremski@mutualink.net>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/ftdi_sio.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 503c89e18187..ebf04c7d49cb 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1567,14 +1567,17 @@ static void ftdi_set_max_packet_size(struct usb_serial_port *port)
 	struct usb_device *udev = serial->dev;
 
 	struct usb_interface *interface = serial->interface;
-	struct usb_endpoint_descriptor *ep_desc = &interface->cur_altsetting->endpoint[1].desc;
+	struct usb_endpoint_descriptor *ep_desc;
 
 	unsigned num_endpoints;
-	int i;
+	unsigned i;
 
 	num_endpoints = interface->cur_altsetting->desc.bNumEndpoints;
 	dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints);
 
+	if (!num_endpoints)
+		return;
+
 	/* NOTE: some customers have programmed FT232R/FT245R devices
 	 * with an endpoint size of 0 - not good.  In this case, we
 	 * want to override the endpoint descriptor setting and use a
-- 
2.0.0


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

* [PATCH 3.12 073/170] usb: gadget: f_fs: fix NULL pointer dereference when there are no strings
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (71 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 072/170] USB: ftdi_sio: fix null deref at port probe Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 074/170] rt2x00: disable TKIP on USB Jiri Slaby
                   ` (97 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Michal Nazarewicz, Felipe Balbi, Jiri Slaby

From: Michal Nazarewicz <mina86@mina86.com>

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

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

commit f0688c8b81d2ea239c3fb0b848f623b579238d99 upstream.

If the descriptors do not need any strings and user space sends empty
set of strings, the ffs->stringtabs field remains NULL.  Thus
*ffs->stringtabs in functionfs_bind leads to a NULL pointer
dereferenece.

The bug was introduced by commit [fd7c9a007f: “use usb_string_ids_n()”].

While at it, remove double initialisation of lang local variable in
that function.

ffs->strings_count does not need to be checked in any way since in
the above scenario it will remain zero and usb_string_ids_n() is
a no-operation when colled with 0 argument.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/gadget/f_fs.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 44cf775a8627..c3067f4f213a 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -1389,11 +1389,13 @@ static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev)
 	ffs->ep0req->context = ffs;
 
 	lang = ffs->stringtabs;
-	for (lang = ffs->stringtabs; *lang; ++lang) {
-		struct usb_string *str = (*lang)->strings;
-		int id = first_id;
-		for (; str->s; ++id, ++str)
-			str->id = id;
+	if (lang) {
+		for (; *lang; ++lang) {
+			struct usb_string *str = (*lang)->strings;
+			int id = first_id;
+			for (; str->s; ++id, ++str)
+				str->id = id;
+		}
 	}
 
 	ffs->gadget = cdev->gadget;
-- 
2.0.0


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

* [PATCH 3.12 074/170] rt2x00: disable TKIP on USB
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (72 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 073/170] usb: gadget: f_fs: fix NULL pointer dereference when there are no strings Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 075/170] rt2x00: fix rfkill regression on rt2500pci Jiri Slaby
                   ` (96 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Stanislaw Gruszka, John W. Linville, Jiri Slaby

From: Stanislaw Gruszka <sgruszka@redhat.com>

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

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

commit 8edcb0ba0d56f5914eef11eda6db8bfe74eb9ca8 upstream.

On USB we can not get atomically TKIP key. We have to disable support
for TKIP acceleration on USB hardware to avoid bug as showed bellow.

[  860.827243] BUG: scheduling while atomic: hostapd/3397/0x00000002
<snip>
[  860.827280] Call Trace:
[  860.827282]  [<ffffffff81682ea6>] dump_stack+0x4d/0x66
[  860.827284]  [<ffffffff8167eb9b>] __schedule_bug+0x47/0x55
[  860.827285]  [<ffffffff81685bb3>] __schedule+0x733/0x7b0
[  860.827287]  [<ffffffff81685c59>] schedule+0x29/0x70
[  860.827289]  [<ffffffff81684f8a>] schedule_timeout+0x15a/0x2b0
[  860.827291]  [<ffffffff8105ac50>] ? ftrace_raw_event_tick_stop+0xc0/0xc0
[  860.827294]  [<ffffffff810c13c2>] ? __module_text_address+0x12/0x70
[  860.827296]  [<ffffffff81686823>] wait_for_completion_timeout+0xb3/0x140
[  860.827298]  [<ffffffff81080fc0>] ? wake_up_state+0x20/0x20
[  860.827301]  [<ffffffff814d5b3d>] usb_start_wait_urb+0x7d/0x150
[  860.827303]  [<ffffffff814d5cd5>] usb_control_msg+0xc5/0x110
[  860.827305]  [<ffffffffa02fb0c6>] rt2x00usb_vendor_request+0xc6/0x160  [rt2x00usb]
[  860.827307]  [<ffffffffa02fb215>] rt2x00usb_vendor_req_buff_lock+0x75/0x150 [rt2x00usb]
[  860.827309]  [<ffffffffa02fb393>] rt2x00usb_vendor_request_buff+0xa3/0xe0 [rt2x00usb]
[  860.827311]  [<ffffffffa023d1a3>] rt2x00usb_register_multiread+0x33/0x40 [rt2800usb]
[  860.827314]  [<ffffffffa05805f9>] rt2800_get_tkip_seq+0x39/0x50  [rt2800lib]
[  860.827321]  [<ffffffffa0480f88>] ieee80211_get_key+0x218/0x2a0  [mac80211]
[  860.827322]  [<ffffffff815cc68c>] ? __nlmsg_put+0x6c/0x80
[  860.827329]  [<ffffffffa051b02e>] nl80211_get_key+0x22e/0x360 [cfg80211]

Reported-and-tested-by: Peter Wu <lekensteyn@gmail.com>
Reported-and-tested-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/wireless/rt2x00/rt2x00mac.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 2b724fc4e306..c03748dafd49 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -489,6 +489,8 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 	crypto.cipher = rt2x00crypto_key_to_cipher(key);
 	if (crypto.cipher == CIPHER_NONE)
 		return -EOPNOTSUPP;
+	if (crypto.cipher == CIPHER_TKIP && rt2x00_is_usb(rt2x00dev))
+		return -EOPNOTSUPP;
 
 	crypto.cmd = cmd;
 
-- 
2.0.0


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

* [PATCH 3.12 075/170] rt2x00: fix rfkill regression on rt2500pci
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (73 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 074/170] rt2x00: disable TKIP on USB Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 076/170] mtd: eLBC NAND: fix subpage write support Jiri Slaby
                   ` (95 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Stanislaw Gruszka, John W. Linville, Jiri Slaby

From: Stanislaw Gruszka <stf_xl@wp.pl>

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

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

commit 616a8394b5df8c88f4dd416f4527439a4e365034 upstream.

As reported by Niels, starting rfkill polling during device probe
(commit e2bc7c5, generally sane change) broke rfkill on rt2500pci
device. I considered that bug as some initalization issue, which
should be fixed on rt2500pci specific code. But after several
attempts (see bug report for details) we fail to find working solution.
Hence I decided to revert to old behaviour on rt2500pci to fix
regression.

Additionally patch also unregister rfkill on device remove instead
of ifconfig down, what was another issue introduced by bad commit.

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

Fixes: e2bc7c5f3cb8 ("rt2x00: Fix rfkill_polling register function.")
Bisected-by: Niels <nille0386@googlemail.com>
Reported-and-tested-by: Niels <nille0386@googlemail.com>
Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/wireless/rt2x00/rt2500pci.c |  7 ++++++-
 drivers/net/wireless/rt2x00/rt2x00.h    |  1 +
 drivers/net/wireless/rt2x00/rt2x00dev.c | 24 +++++++++++++++++++++---
 3 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 0ac5c589ddce..13f557a44a62 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1684,8 +1684,13 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
 	/*
 	 * Detect if this device has an hardware controlled radio.
 	 */
-	if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
+	if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) {
 		__set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
+		/*
+		 * On this device RFKILL initialized during probe does not work.
+		 */
+		__set_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags);
+	}
 
 	/*
 	 * Check if the BBP tuning should be enabled.
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index fe4c572db52c..89dbf2db93da 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -705,6 +705,7 @@ enum rt2x00_capability_flags {
 	REQUIRE_SW_SEQNO,
 	REQUIRE_HT_TX_DESC,
 	REQUIRE_PS_AUTOWAKE,
+	REQUIRE_DELAYED_RFKILL,
 
 	/*
 	 * Capabilities
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index f12e909cbb48..6ccfa0a671e7 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -1128,9 +1128,10 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev)
 		return;
 
 	/*
-	 * Unregister extra components.
+	 * Stop rfkill polling.
 	 */
-	rt2x00rfkill_unregister(rt2x00dev);
+	if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
+		rt2x00rfkill_unregister(rt2x00dev);
 
 	/*
 	 * Allow the HW to uninitialize.
@@ -1168,6 +1169,12 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev)
 
 	set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags);
 
+	/*
+	 * Start rfkill polling.
+	 */
+	if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
+		rt2x00rfkill_register(rt2x00dev);
+
 	return 0;
 }
 
@@ -1377,7 +1384,12 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
 	rt2x00link_register(rt2x00dev);
 	rt2x00leds_register(rt2x00dev);
 	rt2x00debug_register(rt2x00dev);
-	rt2x00rfkill_register(rt2x00dev);
+
+	/*
+	 * Start rfkill polling.
+	 */
+	if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
+		rt2x00rfkill_register(rt2x00dev);
 
 	return 0;
 
@@ -1393,6 +1405,12 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
 	clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
 
 	/*
+	 * Stop rfkill polling.
+	 */
+	if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
+		rt2x00rfkill_unregister(rt2x00dev);
+
+	/*
 	 * Disable radio.
 	 */
 	rt2x00lib_disable_radio(rt2x00dev);
-- 
2.0.0


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

* [PATCH 3.12 076/170] mtd: eLBC NAND: fix subpage write support
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (74 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 075/170] rt2x00: fix rfkill regression on rt2500pci Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 077/170] mtd: nand: omap: fix BCHx ecc.correct to return detected bit-flips in erased-page Jiri Slaby
                   ` (94 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Pekon Gupta, Brian Norris, Jiri Slaby

From: Pekon Gupta <pekon@ti.com>

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

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

commit f034d87def51f026b735d1e2877e9387011b2ba3 upstream.

As subpage write is enabled by default for all drivers, nand_write_subpage_hwecc
causes a crash if the driver did not register ecc->hwctl or ecc->calculate.
This behavior was introduced in
   commit 837a6ba4f3b6d23026674e6af6b6849a4634fff9
   "mtd: nand: subpage write support for hardware based ECC schemes".

This fixes a crash by emulating subpage write support by padding sub-page data
with 0xff on either sides to make it full page compatible.

Reported-by: Helmut Schaa <helmut.schaa@googlemail.com>
Tested-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Pekon Gupta <pekon@ti.com>
Reviewed-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/mtd/nand/fsl_elbc_nand.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index 20657209a472..c31d183820c5 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -725,6 +725,19 @@ static int fsl_elbc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
 	return 0;
 }
 
+/* ECC will be calculated automatically, and errors will be detected in
+ * waitfunc.
+ */
+static int fsl_elbc_write_subpage(struct mtd_info *mtd, struct nand_chip *chip,
+				uint32_t offset, uint32_t data_len,
+				const uint8_t *buf, int oob_required)
+{
+	fsl_elbc_write_buf(mtd, buf, mtd->writesize);
+	fsl_elbc_write_buf(mtd, chip->oob_poi, mtd->oobsize);
+
+	return 0;
+}
+
 static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)
 {
 	struct fsl_lbc_ctrl *ctrl = priv->ctrl;
@@ -763,6 +776,7 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)
 
 	chip->ecc.read_page = fsl_elbc_read_page;
 	chip->ecc.write_page = fsl_elbc_write_page;
+	chip->ecc.write_subpage = fsl_elbc_write_subpage;
 
 	/* If CS Base Register selects full hardware ECC then use it */
 	if ((in_be32(&lbc->bank[priv->bank].br) & BR_DECC) ==
-- 
2.0.0


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

* [PATCH 3.12 077/170] mtd: nand: omap: fix BCHx ecc.correct to return detected bit-flips in erased-page
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (75 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 076/170] mtd: eLBC NAND: fix subpage write support Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 078/170] vgaswitcheroo: switch the mux to the igp on power down when runpm is enabled Jiri Slaby
                   ` (93 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, pekon gupta, Brian Norris, Jiri Slaby

From: pekon gupta <pekon@ti.com>

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

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

commit f306e8c3b667632952f1a4a74ffb910bbc06255f upstream.

fixes: commit 62116e5171e00f85a8d53f76e45b84423c89ff34
       mtd: nand: omap2: Support for hardware BCH error correction.

In omap_elm_correct_data(), if bitflip_count in an erased-page is within the
correctable limit (< ecc.strength), then it is not indicated back to the caller
ecc->read_page().

This mis-guides upper layers like MTD and UBIFS layer to assume erased-page as
perfectly clean and use it for writing even if actual bitflip_count was
dangerously high (bitflip_count > mtd->bitflip_threshold).

This patch fixes this above issue, by returning 'stats' to caller
ecc->read_page() under all scenarios.

Reported-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Pekon Gupta <pekon@ti.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/mtd/nand/omap2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 4ecf0e5fd484..0332d0b2d73a 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -1463,7 +1463,7 @@ static int omap_elm_correct_data(struct mtd_info *mtd, u_char *data,
 
 	/* Check if any error reported */
 	if (!is_error_reported)
-		return 0;
+		return stat;
 
 	/* Decode BCH error using ELM module */
 	elm_decode_bch_error_page(info->elm_dev, ecc_vec, err_vec);
-- 
2.0.0


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

* [PATCH 3.12 078/170] vgaswitcheroo: switch the mux to the igp on power down when runpm is enabled
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (76 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 077/170] mtd: nand: omap: fix BCHx ecc.correct to return detected bit-flips in erased-page Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 079/170] drm/radeon: only apply hdmi bpc pll flags when encoder mode is hdmi Jiri Slaby
                   ` (92 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 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 f2bc561610962693be61425cf913778586d8f9c1 upstream.

Avoids blank screens on muxed systems when runpm is active.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=75917

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/vga/vga_switcheroo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index ec0ae2d1686a..6866448083b2 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -623,7 +623,8 @@ static int vga_switcheroo_runtime_suspend(struct device *dev)
 	ret = dev->bus->pm->runtime_suspend(dev);
 	if (ret)
 		return ret;
-
+	if (vgasr_priv.handler->switchto)
+		vgasr_priv.handler->switchto(VGA_SWITCHEROO_IGD);
 	vga_switcheroo_power_switch(pdev, VGA_SWITCHEROO_OFF);
 	return 0;
 }
-- 
2.0.0


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

* [PATCH 3.12 079/170] drm/radeon: only apply hdmi bpc pll flags when encoder mode is hdmi
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (77 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 078/170] vgaswitcheroo: switch the mux to the igp on power down when runpm is enabled Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 080/170] drm/radeon: fix typo in radeon_connector_is_dp12_capable() Jiri Slaby
                   ` (91 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 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 7d5ab3009a8ca777174f6f469277b3922d56fd4b upstream.

May fix display issues with non-HDMI displays.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/atombios_crtc.c | 48 ++++++++++++++++++----------------
 1 file changed, 26 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index dcb652a6f924..ba8742ab85ee 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -859,14 +859,16 @@ static void atombios_crtc_program_pll(struct drm_crtc *crtc,
 			args.v5.ucMiscInfo = 0; /* HDMI depth, etc. */
 			if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK))
 				args.v5.ucMiscInfo |= PIXEL_CLOCK_V5_MISC_REF_DIV_SRC;
-			switch (bpc) {
-			case 8:
-			default:
-				args.v5.ucMiscInfo |= PIXEL_CLOCK_V5_MISC_HDMI_24BPP;
-				break;
-			case 10:
-				args.v5.ucMiscInfo |= PIXEL_CLOCK_V5_MISC_HDMI_30BPP;
-				break;
+			if (encoder_mode == ATOM_ENCODER_MODE_HDMI) {
+				switch (bpc) {
+				case 8:
+				default:
+					args.v5.ucMiscInfo |= PIXEL_CLOCK_V5_MISC_HDMI_24BPP;
+					break;
+				case 10:
+					args.v5.ucMiscInfo |= PIXEL_CLOCK_V5_MISC_HDMI_30BPP;
+					break;
+				}
 			}
 			args.v5.ucTransmitterID = encoder_id;
 			args.v5.ucEncoderMode = encoder_mode;
@@ -881,20 +883,22 @@ static void atombios_crtc_program_pll(struct drm_crtc *crtc,
 			args.v6.ucMiscInfo = 0; /* HDMI depth, etc. */
 			if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK))
 				args.v6.ucMiscInfo |= PIXEL_CLOCK_V6_MISC_REF_DIV_SRC;
-			switch (bpc) {
-			case 8:
-			default:
-				args.v6.ucMiscInfo |= PIXEL_CLOCK_V6_MISC_HDMI_24BPP;
-				break;
-			case 10:
-				args.v6.ucMiscInfo |= PIXEL_CLOCK_V6_MISC_HDMI_30BPP;
-				break;
-			case 12:
-				args.v6.ucMiscInfo |= PIXEL_CLOCK_V6_MISC_HDMI_36BPP;
-				break;
-			case 16:
-				args.v6.ucMiscInfo |= PIXEL_CLOCK_V6_MISC_HDMI_48BPP;
-				break;
+			if (encoder_mode == ATOM_ENCODER_MODE_HDMI) {
+				switch (bpc) {
+				case 8:
+				default:
+					args.v6.ucMiscInfo |= PIXEL_CLOCK_V6_MISC_HDMI_24BPP;
+					break;
+				case 10:
+					args.v6.ucMiscInfo |= PIXEL_CLOCK_V6_MISC_HDMI_30BPP;
+					break;
+				case 12:
+					args.v6.ucMiscInfo |= PIXEL_CLOCK_V6_MISC_HDMI_36BPP;
+					break;
+				case 16:
+					args.v6.ucMiscInfo |= PIXEL_CLOCK_V6_MISC_HDMI_48BPP;
+					break;
+				}
 			}
 			args.v6.ucTransmitterID = encoder_id;
 			args.v6.ucEncoderMode = encoder_mode;
-- 
2.0.0


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

* [PATCH 3.12 080/170] drm/radeon: fix typo in radeon_connector_is_dp12_capable()
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (78 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 079/170] drm/radeon: only apply hdmi bpc pll flags when encoder mode is hdmi Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 081/170] drm/radeon/dp: fix lane/clock setup for dp 1.2 capable devices Jiri Slaby
                   ` (90 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 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 af5d36539dfe043f1cf0f8b7334d6bb12cd14e75 upstream.

We were checking the ext clock rather than the display clock.

Noticed by ArtForz on IRC.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/radeon_connectors.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 64565732cb98..fe90b3e28d88 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -1360,7 +1360,7 @@ bool radeon_connector_is_dp12_capable(struct drm_connector *connector)
 	struct radeon_device *rdev = dev->dev_private;
 
 	if (ASIC_IS_DCE5(rdev) &&
-	    (rdev->clock.dp_extclk >= 53900) &&
+	    (rdev->clock.default_dispclk >= 53900) &&
 	    radeon_connector_encoder_is_hbr2(connector)) {
 		return true;
 	}
-- 
2.0.0


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

* [PATCH 3.12 081/170] drm/radeon/dp: fix lane/clock setup for dp 1.2 capable devices
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (79 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 080/170] drm/radeon: fix typo in radeon_connector_is_dp12_capable() Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 082/170] drm/radeon/atom: fix dithering on certain panels Jiri Slaby
                   ` (89 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 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 3b6d9fd23e015b5397c438fd3cd74147d2c805b6 upstream.

Only DCE5+ asics support DP 1.2.

Noticed by ArtForz on IRC.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/atombios_dp.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
index 00885417ffff..4601969be373 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -384,6 +384,19 @@ static int dp_get_max_dp_pix_clock(int link_rate,
 
 /***** radeon specific DP functions *****/
 
+static int radeon_dp_get_max_link_rate(struct drm_connector *connector,
+				       u8 dpcd[DP_DPCD_SIZE])
+{
+	int max_link_rate;
+
+	if (radeon_connector_is_dp12_capable(connector))
+		max_link_rate = min(drm_dp_max_link_rate(dpcd), 540000);
+	else
+		max_link_rate = min(drm_dp_max_link_rate(dpcd), 270000);
+
+	return max_link_rate;
+}
+
 /* First get the min lane# when low rate is used according to pixel clock
  * (prefer low rate), second check max lane# supported by DP panel,
  * if the max lane# < low rate lane# then use max lane# instead.
@@ -393,7 +406,7 @@ static int radeon_dp_get_dp_lane_number(struct drm_connector *connector,
 					int pix_clock)
 {
 	int bpp = convert_bpc_to_bpp(radeon_get_monitor_bpc(connector));
-	int max_link_rate = drm_dp_max_link_rate(dpcd);
+	int max_link_rate = radeon_dp_get_max_link_rate(connector, dpcd);
 	int max_lane_num = drm_dp_max_lane_count(dpcd);
 	int lane_num;
 	int max_dp_pix_clock;
@@ -431,7 +444,7 @@ static int radeon_dp_get_dp_link_clock(struct drm_connector *connector,
 			return 540000;
 	}
 
-	return drm_dp_max_link_rate(dpcd);
+	return radeon_dp_get_max_link_rate(connector, dpcd);
 }
 
 static u8 radeon_dp_encoder_service(struct radeon_device *rdev,
-- 
2.0.0


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

* [PATCH 3.12 082/170] drm/radeon/atom: fix dithering on certain panels
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (80 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 081/170] drm/radeon/dp: fix lane/clock setup for dp 1.2 capable devices Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 083/170] drm/radeon: don't allow RADEON_GEM_DOMAIN_CPU for command submission Jiri Slaby
                   ` (88 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 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 642528355c694f5ed68f6bff9ff520326a249f99 upstream.

We need to specify the encoder mode as LVDS for eDP
when using the Crtc_Source atom table in order to properly
set up the FMT hardware.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=73911

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/atombios_encoders.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index 7bb7074a131f..583345636d4b 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -1910,8 +1910,11 @@ atombios_set_encoder_crtc_source(struct drm_encoder *encoder)
 					args.v2.ucEncodeMode = ATOM_ENCODER_MODE_CRT;
 				else
 					args.v2.ucEncodeMode = atombios_get_encoder_mode(encoder);
-			} else
+			} else if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
+				args.v2.ucEncodeMode = ATOM_ENCODER_MODE_LVDS;
+			} else {
 				args.v2.ucEncodeMode = atombios_get_encoder_mode(encoder);
+			}
 			switch (radeon_encoder->encoder_id) {
 			case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
 			case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
-- 
2.0.0


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

* [PATCH 3.12 083/170] drm/radeon: don't allow RADEON_GEM_DOMAIN_CPU for command submission
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (81 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 082/170] drm/radeon/atom: fix dithering on certain panels Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 084/170] drm/radeon/dpm: fix typo in vddci setup for eg/btc Jiri Slaby
                   ` (87 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Marek Olšák, Jiri Slaby

From: Marek Olšák <marek.olsak@amd.com>

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

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

commit ec65da385d46f63740c1c9230b891a6dcbd64c71 upstream.

It hangs the hardware.

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/radeon_cs.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index b2b8b38f0319..ed9a997c99a3 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -97,6 +97,12 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
 			uint32_t domain = r->write_domain ?
 				r->write_domain : r->read_domains;
 
+			if (domain & RADEON_GEM_DOMAIN_CPU) {
+				DRM_ERROR("RADEON_GEM_DOMAIN_CPU is not valid "
+					  "for command submission\n");
+				return -EINVAL;
+			}
+
 			p->relocs[i].lobj.domain = domain;
 			if (domain == RADEON_GEM_DOMAIN_VRAM)
 				domain |= RADEON_GEM_DOMAIN_GTT;
-- 
2.0.0


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

* [PATCH 3.12 084/170] drm/radeon/dpm: fix typo in vddci setup for eg/btc
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (82 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 083/170] drm/radeon: don't allow RADEON_GEM_DOMAIN_CPU for command submission Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 085/170] drm/radeon/dpm: fix vddci setup typo on cayman Jiri Slaby
                   ` (86 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 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 e07929810f0a19ddd756558290c7d72827cbfcd9 upstream.

We were using the vddc mask rather than the vddci mask.

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

Possibly also fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=68571

Noticed-by:  Jonathan Howard <jonathan@unbiased.name>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/cypress_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c
index 91bb470de0a3..7143783fb237 100644
--- a/drivers/gpu/drm/radeon/cypress_dpm.c
+++ b/drivers/gpu/drm/radeon/cypress_dpm.c
@@ -1549,7 +1549,7 @@ int cypress_populate_smc_voltage_tables(struct radeon_device *rdev,
 
 		table->voltageMaskTable.highMask[RV770_SMC_VOLTAGEMASK_VDDCI] = 0;
 		table->voltageMaskTable.lowMask[RV770_SMC_VOLTAGEMASK_VDDCI] =
-			cpu_to_be32(eg_pi->vddc_voltage_table.mask_low);
+			cpu_to_be32(eg_pi->vddci_voltage_table.mask_low);
 	}
 
 	return 0;
-- 
2.0.0


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

* [PATCH 3.12 085/170] drm/radeon/dpm: fix vddci setup typo on cayman
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (83 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 084/170] drm/radeon/dpm: fix typo in vddci setup for eg/btc Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 086/170] drm/radeon/cik: fix typo in EOP packet Jiri Slaby
                   ` (85 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 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 b0880e87c1fd038b84498944f52e52c3e86ebe59 upstream.

We were using the vddc mask rather than the vddci mask.

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

May also fix:
https://bugs.freedesktop.org/show_bug.cgi?id=69723

Noticed by: Dieter Nützel <Dieter@nuetzel-hh.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/ni_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c
index db0fa617e2f5..85f36e702595 100644
--- a/drivers/gpu/drm/radeon/ni_dpm.c
+++ b/drivers/gpu/drm/radeon/ni_dpm.c
@@ -1319,7 +1319,7 @@ static void ni_populate_smc_voltage_tables(struct radeon_device *rdev,
 
 		table->voltageMaskTable.highMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = 0;
 		table->voltageMaskTable.lowMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] =
-			cpu_to_be32(eg_pi->vddc_voltage_table.mask_low);
+			cpu_to_be32(eg_pi->vddci_voltage_table.mask_low);
 	}
 }
 
-- 
2.0.0


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

* [PATCH 3.12 086/170] drm/radeon/cik: fix typo in EOP packet
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (84 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 085/170] drm/radeon/dpm: fix vddci setup typo on cayman Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 087/170] drm/vmwgfx: Fix incorrect write to read-only register v2: Jiri Slaby
                   ` (84 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 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 b397207b7475afa9df2f94541f978100ff1ea47e upstream.

Volatile bit was in the wrong location.  This bit is
not used at the moment.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/cikd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/cikd.h b/drivers/gpu/drm/radeon/cikd.h
index 70e88498a1fd..9c8ef204a3cb 100644
--- a/drivers/gpu/drm/radeon/cikd.h
+++ b/drivers/gpu/drm/radeon/cikd.h
@@ -1695,12 +1695,12 @@
 #define		EOP_TC_WB_ACTION_EN                     (1 << 15) /* L2 */
 #define		EOP_TCL1_ACTION_EN                      (1 << 16)
 #define		EOP_TC_ACTION_EN                        (1 << 17) /* L2 */
+#define		EOP_TCL2_VOLATILE                       (1 << 24)
 #define		EOP_CACHE_POLICY(x)                     ((x) << 25)
                 /* 0 - LRU
 		 * 1 - Stream
 		 * 2 - Bypass
 		 */
-#define		EOP_TCL2_VOLATILE                       (1 << 27)
 #define		DATA_SEL(x)                             ((x) << 29)
                 /* 0 - discard
 		 * 1 - send low 32bit data
-- 
2.0.0


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

* [PATCH 3.12 087/170] drm/vmwgfx: Fix incorrect write to read-only register v2:
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (85 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 086/170] drm/radeon/cik: fix typo in EOP packet Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 088/170] Bluetooth: Fix SSP acceptor just-works confirmation without MITM Jiri Slaby
                   ` (83 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Thomas Hellstrom, Christopher Friedt, Jiri Slaby

From: Thomas Hellstrom <thellstrom@vmware.com>

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

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

commit 4e578080ed3262ed2c3985868539bc66218d25c0 upstream.

Commit "drm/vmwgfx: correct fb_fix_screeninfo.line_length", while fixing a
vmwgfx fbdev bug, also writes the pitch to a supposedly read-only register:
SVGA_REG_BYTES_PER_LINE, while it should be (and also in fact is) written to
SVGA_REG_PITCHLOCK.

This patch is Cc'd stable because of the unknown effects writing to this
register might have, particularly on older device versions.

v2: Updated log message.

Cc: Christopher Friedt <chrisfriedt@gmail.com>
Tested-by: Christopher Friedt <chrisfriedt@gmail.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
index 021b5227e783..1b0f34bd3a03 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
@@ -179,7 +179,6 @@ static int vmw_fb_set_par(struct fb_info *info)
 		vmw_write(vmw_priv, SVGA_REG_DISPLAY_POSITION_Y, info->var.yoffset);
 		vmw_write(vmw_priv, SVGA_REG_DISPLAY_WIDTH, info->var.xres);
 		vmw_write(vmw_priv, SVGA_REG_DISPLAY_HEIGHT, info->var.yres);
-		vmw_write(vmw_priv, SVGA_REG_BYTES_PER_LINE, info->fix.line_length);
 		vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID);
 	}
 
-- 
2.0.0


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

* [PATCH 3.12 088/170] Bluetooth: Fix SSP acceptor just-works confirmation without MITM
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (86 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 087/170] drm/vmwgfx: Fix incorrect write to read-only register v2: Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 089/170] Bluetooth: Fix indicating discovery state when canceling inquiry Jiri Slaby
                   ` (82 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Johan Hedberg, Marcel Holtmann, Jiri Slaby

From: Johan Hedberg <johan.hedberg@intel.com>

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

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

commit ba15a58b179ed76a7e887177f2b06de12c58ec8f upstream.

>From the Bluetooth Core Specification 4.1 page 1958:

"if both devices have set the Authentication_Requirements parameter to
one of the MITM Protection Not Required options, authentication stage 1
shall function as if both devices set their IO capabilities to
DisplayOnly (e.g., Numeric comparison with automatic confirmation on
both devices)"

So far our implementation has done user confirmation for all just-works
cases regardless of the MITM requirements, however following the
specification to the word means that we should not be doing confirmation
when neither side has the MITM flag set.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Tested-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/bluetooth/hci_event.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 2eeb6643d78a..b093ef858e1f 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3164,8 +3164,11 @@ static void hci_user_confirm_request_evt(struct hci_dev *hdev,
 
 		/* If we're not the initiators request authorization to
 		 * proceed from user space (mgmt_user_confirm with
-		 * confirm_hint set to 1). */
-		if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags)) {
+		 * confirm_hint set to 1). The exception is if neither
+		 * side had MITM in which case we do auto-accept.
+		 */
+		if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags) &&
+		    (loc_mitm || rem_mitm)) {
 			BT_DBG("Confirming auto-accept as acceptor");
 			confirm_hint = 1;
 			goto confirm;
-- 
2.0.0


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

* [PATCH 3.12 089/170] Bluetooth: Fix indicating discovery state when canceling inquiry
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (87 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 088/170] Bluetooth: Fix SSP acceptor just-works confirmation without MITM Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 090/170] Bluetooth: Fix locking of hdev when calling into SMP code Jiri Slaby
                   ` (81 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Johan Hedberg, Marcel Holtmann, Jiri Slaby

From: Johan Hedberg <johan.hedberg@intel.com>

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

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

commit 50143a433b70e3145bcf8a4a4e54f0c11bdee32b upstream.

When inquiry is canceled through the HCI_Cancel_Inquiry command there is
no Inquiry Complete event generated. Instead, all we get is the command
complete for the HCI_Inquiry_Cancel command. This means that we must
call the hci_discovery_set_state() function from the respective command
complete handler in order to ensure that user space knows the correct
discovery state.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/bluetooth/hci_event.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index b093ef858e1f..729f516ecd63 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -47,6 +47,10 @@ static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb)
 	smp_mb__after_clear_bit(); /* wake_up_bit advises about this barrier */
 	wake_up_bit(&hdev->flags, HCI_INQUIRY);
 
+	hci_dev_lock(hdev);
+	hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
+	hci_dev_unlock(hdev);
+
 	hci_conn_check_pending(hdev);
 }
 
-- 
2.0.0


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

* [PATCH 3.12 090/170] Bluetooth: Fix locking of hdev when calling into SMP code
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (88 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 089/170] Bluetooth: Fix indicating discovery state when canceling inquiry Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 091/170] Bluetooth: Allow change security level on ATT_CID in slave role Jiri Slaby
                   ` (80 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Johan Hedberg, Marcel Holtmann, Jiri Slaby

From: Johan Hedberg <johan.hedberg@intel.com>

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

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

commit c73f94b8c093a615ce80eabbde0ac6eb9abfe31a upstream.

The SMP code expects hdev to be unlocked since e.g. crypto functions
will try to (re)lock it. Therefore, we need to release the lock before
calling into smp.c from mgmt.c. Without this we risk a deadlock whenever
the smp_user_confirm_reply() function is called.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Tested-by: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/bluetooth/mgmt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index fedc5399d465..211fffb5dca8 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2319,8 +2319,13 @@ static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev,
 	}
 
 	if (addr->type == BDADDR_LE_PUBLIC || addr->type == BDADDR_LE_RANDOM) {
-		/* Continue with pairing via SMP */
+		/* Continue with pairing via SMP. The hdev lock must be
+		 * released as SMP may try to recquire it for crypto
+		 * purposes.
+		 */
+		hci_dev_unlock(hdev);
 		err = smp_user_confirm_reply(conn, mgmt_op, passkey);
+		hci_dev_lock(hdev);
 
 		if (!err)
 			err = cmd_complete(sk, hdev->id, mgmt_op,
-- 
2.0.0


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

* [PATCH 3.12 091/170] Bluetooth: Allow change security level on ATT_CID in slave role
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (89 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 090/170] Bluetooth: Fix locking of hdev when calling into SMP code Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 092/170] dm thin: update discard_granularity to reflect the thin-pool blocksize Jiri Slaby
                   ` (79 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Marcin Kraglak, Marcel Holtmann, Jiri Slaby

From: Marcin Kraglak <marcin.kraglak@tieto.com>

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

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

commit 92d1372e1a9fec00e146b74e8b9ad7a385b9b37f upstream.

Kernel supports SMP Security Request so don't block increasing security
when we are slave.

Signed-off-by: Marcin Kraglak <marcin.kraglak@tieto.com>
Acked-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/bluetooth/l2cap_sock.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 07c9aea21244..a3a81d96314b 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -631,11 +631,6 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
 
 		/*change security for LE channels */
 		if (chan->scid == L2CAP_CID_ATT) {
-			if (!conn->hcon->out) {
-				err = -EINVAL;
-				break;
-			}
-
 			if (smp_conn_security(conn->hcon, sec.level))
 				break;
 			sk->sk_state = BT_CONFIG;
-- 
2.0.0


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

* [PATCH 3.12 092/170] dm thin: update discard_granularity to reflect the thin-pool blocksize
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (90 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 091/170] Bluetooth: Allow change security level on ATT_CID in slave role Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 093/170] rbd: use reference counts for image requests Jiri Slaby
                   ` (78 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Lukas Czerner, Mike Snitzer, Jiri Slaby

From: Lukas Czerner <lczerner@redhat.com>

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

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

commit 09869de57ed2728ae3c619803932a86cb0e2c4f8 upstream.

DM thinp already checks whether the discard_granularity of the data
device is a factor of the thin-pool block size.  But when using the
dm-thin-pool's discard passdown support, DM thinp was not selecting the
max of the underlying data device's discard_granularity and the
thin-pool's block size.

Update set_discard_limits() to set discard_granularity to the max of
these values.  This enables blkdev_issue_discard() to properly align the
discards that are sent to the DM thin device on a full block boundary.
As such each discard will now cover an entire DM thin-pool block and the
block will be reclaimed.

Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/md/dm-thin.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index e4cc196634c1..f8c36d30eca8 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -2695,7 +2695,8 @@ static void set_discard_limits(struct pool_c *pt, struct queue_limits *limits)
 	 */
 	if (pt->adjusted_pf.discard_passdown) {
 		data_limits = &bdev_get_queue(pt->data_dev->bdev)->limits;
-		limits->discard_granularity = data_limits->discard_granularity;
+		limits->discard_granularity = max(data_limits->discard_granularity,
+						  pool->sectors_per_block << SECTOR_SHIFT);
 	} else
 		limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT;
 }
-- 
2.0.0


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

* [PATCH 3.12 093/170] rbd: use reference counts for image requests
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (91 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 092/170] dm thin: update discard_granularity to reflect the thin-pool blocksize Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 094/170] rbd: handle parent_overlap on writes correctly Jiri Slaby
                   ` (77 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alex Elder, Jiri Slaby

From: Alex Elder <elder@linaro.org>

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

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

commit 0f2d5be792b0466b06797f637cfbb0f64dbb408c upstream.

Each image request contains a reference count, but to date it has
not actually been used.  (I think this was just an oversight.) A
recent report involving rbd failing an assertion shed light on why
and where we need to use these reference counts.

Every OSD request associated with an object request uses
rbd_osd_req_callback() as its callback function.  That function will
call a helper function (dependent on the type of OSD request) that
will set the object request's "done" flag if the object request if
appropriate.  If that "done" flag is set, the object request is
passed to rbd_obj_request_complete().

In rbd_obj_request_complete(), requests are processed in sequential
order.  So if an object request completes before one of its
predecessors in the image request, the completion is deferred.
Otherwise, if it's a completing object's "turn" to be completed, it
is passed to rbd_img_obj_end_request(), which records the result of
the operation, accumulates transferred bytes, and so on.  Next, the
successor to this request is checked and if it is marked "done",
(deferred) completion processing is performed on that request, and
so on.  If the last object request in an image request is completed,
rbd_img_request_complete() is called, which (typically) destroys
the image request.

There is a race here, however.  The instant an object request is
marked "done" it can be provided (by a thread handling completion of
one of its predecessor operations) to rbd_img_obj_end_request(),
which (for the last request) can then lead to the image request
getting torn down.  And this can happen *before* that object has
itself entered rbd_img_obj_end_request().  As a result, once it
*does* enter that function, the image request (and even the object
request itself) may have been freed and become invalid.

All that's necessary to avoid this is to properly count references
to the image requests.  We tear down an image request's object
requests all at once--only when the entire image request has
completed.  So there's no need for an image request to count
references for its object requests.  However, we don't want an
image request to go away until the last of its object requests
has passed through rbd_img_obj_callback().  In other words,
we don't want rbd_img_request_complete() to necessarily
result in the image request being destroyed, because it may
get called before we've finished processing on all of its
object requests.

So the fix is to add a reference to an image request for
each of its object requests.  The reference can be viewed
as representing an object request that has not yet finished
its call to rbd_img_obj_callback().  That is emphasized by
getting the reference right after assigning that as the image
object's callback function.  The corresponding release of that
reference is done at the end of rbd_img_obj_callback(), which
every image object request passes through exactly once.

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

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index db60c91804c3..af7b44ffd190 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1395,6 +1395,13 @@ static void rbd_obj_request_put(struct rbd_obj_request *obj_request)
 	kref_put(&obj_request->kref, rbd_obj_request_destroy);
 }
 
+static void rbd_img_request_get(struct rbd_img_request *img_request)
+{
+	dout("%s: img %p (was %d)\n", __func__, img_request,
+	     atomic_read(&img_request->kref.refcount));
+	kref_get(&img_request->kref);
+}
+
 static bool img_request_child_test(struct rbd_img_request *img_request);
 static void rbd_parent_request_destroy(struct kref *kref);
 static void rbd_img_request_destroy(struct kref *kref);
@@ -2148,6 +2155,7 @@ static void rbd_img_obj_callback(struct rbd_obj_request *obj_request)
 	img_request->next_completion = which;
 out:
 	spin_unlock_irq(&img_request->completion_lock);
+	rbd_img_request_put(img_request);
 
 	if (!more)
 		rbd_img_request_complete(img_request);
@@ -2244,6 +2252,7 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request,
 			goto out_partial;
 		obj_request->osd_req = osd_req;
 		obj_request->callback = rbd_img_obj_callback;
+		rbd_img_request_get(img_request);
 
 		osd_req_op_extent_init(osd_req, 0, opcode, offset, length,
 						0, 0);
-- 
2.0.0


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

* [PATCH 3.12 094/170] rbd: handle parent_overlap on writes correctly
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (92 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 093/170] rbd: use reference counts for image requests Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 095/170] hwmon: (ina2xx) Cast to s16 on shunt and current regs Jiri Slaby
                   ` (76 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 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 9638556a276125553549fdfe349c464481ec2f39 upstream.

The following check in rbd_img_obj_request_submit()

    rbd_dev->parent_overlap <= obj_request->img_offset

allows the fall through to the non-layered write case even if both
parent_overlap and obj_request->img_offset belong to the same RADOS
object.  This leads to data corruption, because the area to the left of
parent_overlap ends up unconditionally zero-filled instead of being
populated with parent data.  Suppose we want to write 1M to offset 6M
of image bar, which is a clone of foo@snap; object_size is 4M,
parent_overlap is 5M:

    rbd_data.<id>.0000000000000001
     ---------------------|----------------------|------------
    | should be copyup'ed | should be zeroed out | write ...
     ---------------------|----------------------|------------
   4M                    5M                     6M
                    parent_overlap    obj_request->img_offset

4..5M should be copyup'ed from foo, yet it is zero-filled, just like
5..6M is.

Given that the only striping mode kernel client currently supports is
chunking (i.e. stripe_unit == object_size, stripe_count == 1), round
parent_overlap up to the next object boundary for the purposes of the
overlap check.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/block/rbd.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index af7b44ffd190..aeeb62e0981a 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1379,6 +1379,14 @@ static bool obj_request_exists_test(struct rbd_obj_request *obj_request)
 	return test_bit(OBJ_REQ_EXISTS, &obj_request->flags) != 0;
 }
 
+static bool obj_request_overlaps_parent(struct rbd_obj_request *obj_request)
+{
+	struct rbd_device *rbd_dev = obj_request->img_request->rbd_dev;
+
+	return obj_request->img_offset <
+	    round_up(rbd_dev->parent_overlap, rbd_obj_bytes(&rbd_dev->header));
+}
+
 static void rbd_obj_request_get(struct rbd_obj_request *obj_request)
 {
 	dout("%s: obj %p (was %d)\n", __func__, obj_request,
@@ -2675,7 +2683,7 @@ static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request)
 	 */
 	if (!img_request_write_test(img_request) ||
 		!img_request_layered_test(img_request) ||
-		rbd_dev->parent_overlap <= obj_request->img_offset ||
+		!obj_request_overlaps_parent(obj_request) ||
 		((known = obj_request_known_test(obj_request)) &&
 			obj_request_exists_test(obj_request))) {
 
-- 
2.0.0


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

* [PATCH 3.12 095/170] hwmon: (ina2xx) Cast to s16 on shunt and current regs
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (93 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 094/170] rbd: handle parent_overlap on writes correctly Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 096/170] mac80211: fix IBSS join by initializing last_scan_completed Jiri Slaby
                   ` (75 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Fabio Baltieri, Guenter Roeck, Jiri Slaby

From: Fabio Baltieri <fabio.baltieri@gmail.com>

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

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

commit c0214f98943b1fe43f7be61b7782b0c8f0836f28 upstream.

All devices supported by ina2xx are bidirectional and report the
measured shunt voltage and power values as a signed 16 bit, but the
current driver implementation caches all registers as u16, leading
to an incorrect sign extension when reporting to userspace in
ina2xx_get_value().

This patch fixes the problem by casting the signed registers to s16.
Tested on an INA219.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hwmon/ina2xx.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
index 70a39a8ac016..554f5c3fe5c4 100644
--- a/drivers/hwmon/ina2xx.c
+++ b/drivers/hwmon/ina2xx.c
@@ -148,7 +148,8 @@ static int ina2xx_get_value(struct ina2xx_data *data, u8 reg)
 
 	switch (reg) {
 	case INA2XX_SHUNT_VOLTAGE:
-		val = DIV_ROUND_CLOSEST(data->regs[reg],
+		/* signed register */
+		val = DIV_ROUND_CLOSEST((s16)data->regs[reg],
 					data->config->shunt_div);
 		break;
 	case INA2XX_BUS_VOLTAGE:
@@ -160,8 +161,8 @@ static int ina2xx_get_value(struct ina2xx_data *data, u8 reg)
 		val = data->regs[reg] * data->config->power_lsb;
 		break;
 	case INA2XX_CURRENT:
-		/* LSB=1mA (selected). Is in mA */
-		val = data->regs[reg];
+		/* signed register, LSB=1mA (selected), in mA */
+		val = (s16)data->regs[reg];
 		break;
 	default:
 		/* programmer goofed */
-- 
2.0.0


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

* [PATCH 3.12 096/170] mac80211: fix IBSS join by initializing last_scan_completed
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (94 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 095/170] hwmon: (ina2xx) Cast to s16 on shunt and current regs Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 097/170] mac80211: don't check netdev state for debugfs read/write Jiri Slaby
                   ` (74 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Krzysztof Hałasa, Johannes Berg, Jiri Slaby

From: Krzysztof Hałasa <khalasa@piap.pl>

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

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

commit c7d37a66e345df2fdf1aa7b2c9a6d3d53846ca5b upstream.

Without this fix, freshly rebooted Linux creates a new IBSS
instead of joining an existing one. Only when jiffies counter
overflows after 5 minutes the IBSS can be successfully joined.

Signed-off-by: Krzysztof Hałasa <khalasa@piap.pl>
[edit commit message slightly]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/mac80211/ibss.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index a12afe77bb26..f69cac4bf39f 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -1203,6 +1203,7 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
 	sdata->u.ibss.privacy = params->privacy;
 	sdata->u.ibss.control_port = params->control_port;
 	sdata->u.ibss.basic_rates = params->basic_rates;
+	sdata->u.ibss.last_scan_completed = jiffies;
 
 	/* fix basic_rates if channel does not support these rates */
 	rate_flags = ieee80211_chandef_rate_flags(&params->chandef);
-- 
2.0.0


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

* [PATCH 3.12 097/170] mac80211: don't check netdev state for debugfs read/write
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (95 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 096/170] mac80211: fix IBSS join by initializing last_scan_completed Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 098/170] mac80211: fix a memory leak on sta rate selection table Jiri Slaby
                   ` (73 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Arik Nemtsov, Arik Nemtsov, Emmanuel Grumbach,
	Johannes Berg, Jiri Slaby

From: Arik Nemtsov <arik@wizery.com>

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

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

commit 923eaf367206e01f22c97aee22300e332d071916 upstream.

Doing so will lead to an oops for a p2p-dev interface, since it has
no netdev.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/mac80211/debugfs_netdev.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index cafe614ef93d..8e41f0163c5a 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -34,8 +34,7 @@ static ssize_t ieee80211_if_read(
 	ssize_t ret = -EINVAL;
 
 	read_lock(&dev_base_lock);
-	if (sdata->dev->reg_state == NETREG_REGISTERED)
-		ret = (*format)(sdata, buf, sizeof(buf));
+	ret = (*format)(sdata, buf, sizeof(buf));
 	read_unlock(&dev_base_lock);
 
 	if (ret >= 0)
@@ -62,8 +61,7 @@ static ssize_t ieee80211_if_write(
 
 	ret = -ENODEV;
 	rtnl_lock();
-	if (sdata->dev->reg_state == NETREG_REGISTERED)
-		ret = (*write)(sdata, buf, count);
+	ret = (*write)(sdata, buf, count);
 	rtnl_unlock();
 
 	return ret;
-- 
2.0.0


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

* [PATCH 3.12 098/170] mac80211: fix a memory leak on sta rate selection table
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (96 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 097/170] mac80211: don't check netdev state for debugfs read/write Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 099/170] iwlwifi: pcie: try to get ownership several times Jiri Slaby
                   ` (72 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Felix Fietkau, Johannes Berg, Jiri Slaby

From: Felix Fietkau <nbd@openwrt.org>

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

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

commit 53d045258ee2e38b1e882617cb0799a04d05f5fa upstream.

If the rate control algorithm uses a selection table, it
is leaked when the station is destroyed - fix that.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Reported-by: Christophe Prévotaux <cprevotaux@nltinc.com>
Fixes: 0d528d85c519 ("mac80211: improve the rate control API")
[add commit log entry, remove pointless NULL check]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/mac80211/sta_info.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index db41c190e76d..37025725c369 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -271,6 +271,7 @@ void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
 
 	sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
 
+	kfree(rcu_dereference_raw(sta->sta.rates));
 	kfree(sta);
 }
 
-- 
2.0.0


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

* [PATCH 3.12 099/170] iwlwifi: pcie: try to get ownership several times
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (97 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 098/170] mac80211: fix a memory leak on sta rate selection table Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 100/170] hugetlb: fix copy_hugetlb_page_range() to handle migration/hwpoisoned entry Jiri Slaby
                   ` (71 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 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 501fd9895c1d7d8161ed56698ae2fccb10ef14f5 upstream.

Some races with the hardware can happen when we take
ownership of the device. Don't give up after the first try.

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/trans.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 7bdaf06b8f5a..dc875f4befef 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -345,6 +345,7 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans)
 {
 	int ret;
 	int t = 0;
+	int iter;
 
 	IWL_DEBUG_INFO(trans, "iwl_trans_prepare_card_hw enter\n");
 
@@ -353,18 +354,23 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans)
 	if (ret >= 0)
 		return 0;
 
-	/* If HW is not ready, prepare the conditions to check again */
-	iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,
-		    CSR_HW_IF_CONFIG_REG_PREPARE);
+	for (iter = 0; iter < 10; iter++) {
+		/* If HW is not ready, prepare the conditions to check again */
+		iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,
+			    CSR_HW_IF_CONFIG_REG_PREPARE);
+
+		do {
+			ret = iwl_pcie_set_hw_ready(trans);
+			if (ret >= 0)
+				return 0;
 
-	do {
-		ret = iwl_pcie_set_hw_ready(trans);
-		if (ret >= 0)
-			return 0;
+			usleep_range(200, 1000);
+			t += 200;
+		} while (t < 150000);
+		msleep(25);
+	}
 
-		usleep_range(200, 1000);
-		t += 200;
-	} while (t < 150000);
+	IWL_DEBUG_INFO(trans, "got NIC after %d iterations\n", iter);
 
 	return ret;
 }
-- 
2.0.0


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

* [PATCH 3.12 100/170] hugetlb: fix copy_hugetlb_page_range() to handle migration/hwpoisoned entry
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (98 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 099/170] iwlwifi: pcie: try to get ownership several times Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 18:53   ` Hugh Dickins
  2014-07-18 12:11 ` [PATCH 3.12 101/170] mm, pcp: allow restoring percpu_pagelist_fraction default Jiri Slaby
                   ` (70 subsequent siblings)
  170 siblings, 1 reply; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Naoya Horiguchi, Christoph Lameter, 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 4a705fef986231a3e7a6b1a6d3c37025f021f49f upstream.

There's a race between fork() and hugepage migration, as a result we try
to "dereference" a swap entry as a normal pte, causing kernel panic.
The cause of the problem is that copy_hugetlb_page_range() can't handle
"swap entry" family (migration entry and hwpoisoned entry) so let's fix
it.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Acked-by: Hugh Dickins <hughd@google.com>
Cc: Christoph Lameter <cl@linux.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/hugetlb.c | 71 ++++++++++++++++++++++++++++++++++++------------------------
 1 file changed, 43 insertions(+), 28 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 92e103b72dcb..11c2b7fed052 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2381,6 +2381,31 @@ static void set_huge_ptep_writable(struct vm_area_struct *vma,
 		update_mmu_cache(vma, address, ptep);
 }
 
+static int is_hugetlb_entry_migration(pte_t pte)
+{
+	swp_entry_t swp;
+
+	if (huge_pte_none(pte) || pte_present(pte))
+		return 0;
+	swp = pte_to_swp_entry(pte);
+	if (non_swap_entry(swp) && is_migration_entry(swp))
+		return 1;
+	else
+		return 0;
+}
+
+static int is_hugetlb_entry_hwpoisoned(pte_t pte)
+{
+	swp_entry_t swp;
+
+	if (huge_pte_none(pte) || pte_present(pte))
+		return 0;
+	swp = pte_to_swp_entry(pte);
+	if (non_swap_entry(swp) && is_hwpoison_entry(swp))
+		return 1;
+	else
+		return 0;
+}
 
 int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
 			    struct vm_area_struct *vma)
@@ -2408,10 +2433,26 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
 
 		spin_lock(&dst->page_table_lock);
 		spin_lock_nested(&src->page_table_lock, SINGLE_DEPTH_NESTING);
-		if (!huge_pte_none(huge_ptep_get(src_pte))) {
+		entry = huge_ptep_get(src_pte);
+		if (huge_pte_none(entry)) { /* skip none entry */
+			;
+		} else if (unlikely(is_hugetlb_entry_migration(entry) ||
+				    is_hugetlb_entry_hwpoisoned(entry))) {
+			swp_entry_t swp_entry = pte_to_swp_entry(entry);
+
+			if (is_write_migration_entry(swp_entry) && cow) {
+				/*
+				 * COW mappings require pages in both
+				 * parent and child to be set to read.
+				 */
+				make_migration_entry_read(&swp_entry);
+				entry = swp_entry_to_pte(swp_entry);
+				set_huge_pte_at(src, addr, src_pte, entry);
+			}
+			set_huge_pte_at(dst, addr, dst_pte, entry);
+		} else {
 			if (cow)
 				huge_ptep_set_wrprotect(src, addr, src_pte);
-			entry = huge_ptep_get(src_pte);
 			ptepage = pte_page(entry);
 			get_page(ptepage);
 			page_dup_rmap(ptepage);
@@ -2426,32 +2467,6 @@ nomem:
 	return -ENOMEM;
 }
 
-static int is_hugetlb_entry_migration(pte_t pte)
-{
-	swp_entry_t swp;
-
-	if (huge_pte_none(pte) || pte_present(pte))
-		return 0;
-	swp = pte_to_swp_entry(pte);
-	if (non_swap_entry(swp) && is_migration_entry(swp))
-		return 1;
-	else
-		return 0;
-}
-
-static int is_hugetlb_entry_hwpoisoned(pte_t pte)
-{
-	swp_entry_t swp;
-
-	if (huge_pte_none(pte) || pte_present(pte))
-		return 0;
-	swp = pte_to_swp_entry(pte);
-	if (non_swap_entry(swp) && is_hwpoison_entry(swp))
-		return 1;
-	else
-		return 0;
-}
-
 void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
 			    unsigned long start, unsigned long end,
 			    struct page *ref_page)
-- 
2.0.0


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

* [PATCH 3.12 101/170] mm, pcp: allow restoring percpu_pagelist_fraction default
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (99 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 100/170] hugetlb: fix copy_hugetlb_page_range() to handle migration/hwpoisoned entry Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 102/170] arm64: mm: Make icache synchronisation logic huge page aware Jiri Slaby
                   ` (69 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, David Rientjes, Andrew Morton, Linus Torvalds, Jiri Slaby

From: David Rientjes <rientjes@google.com>

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

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

commit 7cd2b0a34ab8e4db971920eef8982f985441adfb upstream.

Oleg reports a division by zero error on zero-length write() to the
percpu_pagelist_fraction sysctl:

    divide error: 0000 [#1] SMP DEBUG_PAGEALLOC
    CPU: 1 PID: 9142 Comm: badarea_io Not tainted 3.15.0-rc2-vm-nfs+ #19
    Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
    task: ffff8800d5aeb6e0 ti: ffff8800d87a2000 task.ti: ffff8800d87a2000
    RIP: 0010: percpu_pagelist_fraction_sysctl_handler+0x84/0x120
    RSP: 0018:ffff8800d87a3e78  EFLAGS: 00010246
    RAX: 0000000000000f89 RBX: ffff88011f7fd000 RCX: 0000000000000000
    RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000010
    RBP: ffff8800d87a3e98 R08: ffffffff81d002c8 R09: ffff8800d87a3f50
    R10: 000000000000000b R11: 0000000000000246 R12: 0000000000000060
    R13: ffffffff81c3c3e0 R14: ffffffff81cfddf8 R15: ffff8801193b0800
    FS:  00007f614f1e9740(0000) GS:ffff88011f440000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    CR2: 00007f614f1fa000 CR3: 00000000d9291000 CR4: 00000000000006e0
    Call Trace:
      proc_sys_call_handler+0xb3/0xc0
      proc_sys_write+0x14/0x20
      vfs_write+0xba/0x1e0
      SyS_write+0x46/0xb0
      tracesys+0xe1/0xe6

However, if the percpu_pagelist_fraction sysctl is set by the user, it
is also impossible to restore it to the kernel default since the user
cannot write 0 to the sysctl.

This patch allows the user to write 0 to restore the default behavior.
It still requires a fraction equal to or larger than 8, however, as
stated by the documentation for sanity.  If a value in the range [1, 7]
is written, the sysctl will return EINVAL.

This successfully solves the divide by zero issue at the same time.

Signed-off-by: David Rientjes <rientjes@google.com>
Reported-by: Oleg Drokin <green@linuxhacker.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>
---
 Documentation/sysctl/vm.txt |  3 ++-
 kernel/sysctl.c             |  3 +--
 mm/page_alloc.c             | 40 ++++++++++++++++++++++++++++------------
 3 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index 79a797eb3e87..138fe437bba0 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -664,7 +664,8 @@ The batch value of each per cpu pagelist is also updated as a result.  It is
 set to pcp->high/4.  The upper limit of batch is (PAGE_SHIFT * 8)
 
 The initial value is zero.  Kernel does not use this value at boot time to set
-the high water marks for each per cpu page list.
+the high water marks for each per cpu page list.  If the user writes '0' to this
+sysctl, it will revert to this default behavior.
 
 ==============================================================
 
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 2a9db916c3f5..167741003616 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -138,7 +138,6 @@ static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
 static int maxolduid = 65535;
 static int minolduid;
-static int min_percpu_pagelist_fract = 8;
 
 static int ngroups_max = NGROUPS_MAX;
 static const int cap_last_cap = CAP_LAST_CAP;
@@ -1287,7 +1286,7 @@ static struct ctl_table vm_table[] = {
 		.maxlen		= sizeof(percpu_pagelist_fraction),
 		.mode		= 0644,
 		.proc_handler	= percpu_pagelist_fraction_sysctl_handler,
-		.extra1		= &min_percpu_pagelist_fract,
+		.extra1		= &zero,
 	},
 #ifdef CONFIG_MMU
 	{
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a6bf980f5dd0..83aaa49bcba7 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -69,6 +69,7 @@
 
 /* prevent >1 _updater_ of zone percpu pageset ->high and ->batch fields */
 static DEFINE_MUTEX(pcp_batch_high_lock);
+#define MIN_PERCPU_PAGELIST_FRACTION	(8)
 
 #ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID
 DEFINE_PER_CPU(int, numa_node);
@@ -4079,7 +4080,7 @@ static void __meminit zone_init_free_lists(struct zone *zone)
 	memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY)
 #endif
 
-static int __meminit zone_batchsize(struct zone *zone)
+static int zone_batchsize(struct zone *zone)
 {
 #ifdef CONFIG_MMU
 	int batch;
@@ -4195,8 +4196,8 @@ static void pageset_set_high(struct per_cpu_pageset *p,
 	pageset_update(&p->pcp, high, batch);
 }
 
-static void __meminit pageset_set_high_and_batch(struct zone *zone,
-		struct per_cpu_pageset *pcp)
+static void pageset_set_high_and_batch(struct zone *zone,
+				       struct per_cpu_pageset *pcp)
 {
 	if (percpu_pagelist_fraction)
 		pageset_set_high(pcp,
@@ -5789,23 +5790,38 @@ int percpu_pagelist_fraction_sysctl_handler(ctl_table *table, int write,
 	void __user *buffer, size_t *length, loff_t *ppos)
 {
 	struct zone *zone;
-	unsigned int cpu;
+	int old_percpu_pagelist_fraction;
 	int ret;
 
+	mutex_lock(&pcp_batch_high_lock);
+	old_percpu_pagelist_fraction = percpu_pagelist_fraction;
+
 	ret = proc_dointvec_minmax(table, write, buffer, length, ppos);
-	if (!write || (ret < 0))
-		return ret;
+	if (!write || ret < 0)
+		goto out;
+
+	/* Sanity checking to avoid pcp imbalance */
+	if (percpu_pagelist_fraction &&
+	    percpu_pagelist_fraction < MIN_PERCPU_PAGELIST_FRACTION) {
+		percpu_pagelist_fraction = old_percpu_pagelist_fraction;
+		ret = -EINVAL;
+		goto out;
+	}
+
+	/* No change? */
+	if (percpu_pagelist_fraction == old_percpu_pagelist_fraction)
+		goto out;
 
-	mutex_lock(&pcp_batch_high_lock);
 	for_each_populated_zone(zone) {
-		unsigned long  high;
-		high = zone->managed_pages / percpu_pagelist_fraction;
+		unsigned int cpu;
+
 		for_each_possible_cpu(cpu)
-			pageset_set_high(per_cpu_ptr(zone->pageset, cpu),
-					 high);
+			pageset_set_high_and_batch(zone,
+					per_cpu_ptr(zone->pageset, cpu));
 	}
+out:
 	mutex_unlock(&pcp_batch_high_lock);
-	return 0;
+	return ret;
 }
 
 int hashdist = HASHDIST_DEFAULT;
-- 
2.0.0


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

* [PATCH 3.12 102/170] arm64: mm: Make icache synchronisation logic huge page aware
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (100 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 101/170] mm, pcp: allow restoring percpu_pagelist_fraction default Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 103/170] ARM: OMAP2+: Fix parser-bug in platform muxing code Jiri Slaby
                   ` (68 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Steve Capper, Catalin Marinas, Jiri Slaby

From: Steve Capper <steve.capper@linaro.org>

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

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

commit 923b8f5044da753e4985ab15c1374ced2cdf616c upstream.

The __sync_icache_dcache routine will only flush the dcache for the
first page of a compound page, potentially leading to stale icache
data residing further on in a hugetlb page.

This patch addresses this issue by taking into consideration the
order of the page when flushing the dcache.

Reported-by: Mark Brown <broonie@linaro.org>
Tested-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Steve Capper <steve.capper@linaro.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm64/mm/flush.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c
index e4193e3adc7f..0d64089d28b5 100644
--- a/arch/arm64/mm/flush.c
+++ b/arch/arm64/mm/flush.c
@@ -79,7 +79,8 @@ void __sync_icache_dcache(pte_t pte, unsigned long addr)
 		return;
 
 	if (!test_and_set_bit(PG_dcache_clean, &page->flags)) {
-		__flush_dcache_area(page_address(page), PAGE_SIZE);
+		__flush_dcache_area(page_address(page),
+				PAGE_SIZE << compound_order(page));
 		__flush_icache_all();
 	} else if (icache_is_aivivt()) {
 		__flush_icache_all();
-- 
2.0.0


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

* [PATCH 3.12 103/170] ARM: OMAP2+: Fix parser-bug in platform muxing code
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (101 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 102/170] arm64: mm: Make icache synchronisation logic huge page aware Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 104/170] arm64: Bug fix in stack alignment exception Jiri Slaby
                   ` (67 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, David R. Piegdon, Tony Lindgren, Jiri Slaby

From: "David R. Piegdon" <lkml@p23q.org>

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

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

commit c021f241f4fab2bb4fc4120a38a828a03dd3f970 upstream.

Fix a parser-bug in the omap2 muxing code where muxtable-entries will be
wrongly selected if the requested muxname is a *prefix* of their
m0-entry and they have a matching mN-entry. Fix by additionally checking
that the length of the m0_entry is equal.

For example muxing of "dss_data2.dss_data2" on omap32xx will fail
because the prefix "dss_data2" will match the mux-entries "dss_data2" as
well as "dss_data20", with the suffix "dss_data2" matching m0 (for
dss_data2) and m4 (for dss_data20). Thus both are recognized as signal
path candidates:

Relevant muxentries from mux34xx.c:
        _OMAP3_MUXENTRY(DSS_DATA20, 90,
                "dss_data20", NULL, "mcspi3_somi", "dss_data2",
                "gpio_90", NULL, NULL, "safe_mode"),
        _OMAP3_MUXENTRY(DSS_DATA2, 72,
                "dss_data2", NULL, NULL, NULL,
                "gpio_72", NULL, NULL, "safe_mode"),

This will result in a failure to mux the pin at all:

 _omap_mux_get_by_name: Multiple signal paths (2) for dss_data2.dss_data2

Patch should apply to linus' latest master down to rather old linux-2.6
trees.

Signed-off-by: David R. Piegdon <lkml@p23q.org>
Cc: stable@vger.kernel.org
[tony@atomide.com: updated description to include full description]
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/mach-omap2/mux.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index f82cf878d6af..94c2f6d17dae 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -183,8 +183,10 @@ static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition,
 		m0_entry = mux->muxnames[0];
 
 		/* First check for full name in mode0.muxmode format */
-		if (mode0_len && strncmp(muxname, m0_entry, mode0_len))
-			continue;
+		if (mode0_len)
+			if (strncmp(muxname, m0_entry, mode0_len) ||
+			    (strlen(m0_entry) != mode0_len))
+				continue;
 
 		/* Then check for muxmode only */
 		for (i = 0; i < OMAP_MUX_NR_MODES; i++) {
-- 
2.0.0


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

* [PATCH 3.12 104/170] arm64: Bug fix in stack alignment exception
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (102 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 103/170] ARM: OMAP2+: Fix parser-bug in platform muxing code Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 105/170] net: allwinner: emac: Add missing free_irq Jiri Slaby
                   ` (66 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, ChiaHao, Catalin Marinas, Jiri Slaby

From: ChiaHao <andy.jhshiu@gmail.com>

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

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

commit 3906c2b53cd23c2ae03e6ce41432c8e7f0a3cbbb upstream.

The value of ESR has been stored into x1, and should be directly pass to
do_sp_pc_abort function, "MOV x1, x25" is an extra operation and do_sp_pc_abort
will get the wrong value of ESR.

Signed-off-by: ChiaHao <andy.jhshiu@gmail.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm64/kernel/entry.S | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index 3881fd115ebb..028a1b91e2b3 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -275,7 +275,6 @@ el1_sp_pc:
 	 * Stack or PC alignment exception handling
 	 */
 	mrs	x0, far_el1
-	mov	x1, x25
 	mov	x2, sp
 	b	do_sp_pc_abort
 el1_undef:
-- 
2.0.0


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

* [PATCH 3.12 105/170] net: allwinner: emac: Add missing free_irq
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (103 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 104/170] arm64: Bug fix in stack alignment exception Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 106/170] b43: fix frequency reported on G-PHY with /new/ firmware Jiri Slaby
                   ` (65 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Maxime Ripard, David S. Miller, Jiri Slaby

From: Maxime Ripard <maxime.ripard@free-electrons.com>

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

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

commit b91113282bf44df46aba374a0b8f88a75bfd4b3f upstream.

If the mdio probe function fails in emac_open, the interrupt we just requested
isn't freed. If emac_open is called again, for example because we try to set up
the interface again, the kernel will oops because the interrupt wasn't properly
released.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/ethernet/allwinner/sun4i-emac.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
index 46dfb1378c17..81576c6c31e0 100644
--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
+++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
@@ -726,6 +726,7 @@ static int emac_open(struct net_device *dev)
 
 	ret = emac_mdio_probe(dev);
 	if (ret < 0) {
+		free_irq(dev->irq, dev);
 		netdev_err(dev, "cannot probe MDIO bus\n");
 		return ret;
 	}
-- 
2.0.0


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

* [PATCH 3.12 106/170] b43: fix frequency reported on G-PHY with /new/ firmware
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (104 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 105/170] net: allwinner: emac: Add missing free_irq Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 107/170] CIFS: fix mount failure with broken pathnames when smb3 mount with mapchars option Jiri Slaby
                   ` (64 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Rafał Miłecki, John W. Linville, Jiri Slaby

From: Rafał Miłecki <zajec5@gmail.com>

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

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

commit 2fc68eb122c7ea6cd5be1fe7d6650c0beb2f4f40 upstream.

Support for firmware rev 508+ was added years ago, but we never noticed
it reports channel in a different way for G-PHY devices. Instead of
offset from 2400 MHz it simply passes channel id (AKA hw_value).

So far it was (most probably) affecting monitor mode users only, but
the following recent commit made it noticeable for quite everybody:

commit 3afc2167f60a327a2c1e1e2600ef209a3c2b75b7
Author: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Date:   Tue Mar 4 16:50:13 2014 +0200

    cfg80211/mac80211: ignore signal if the frame was heard on wrong channel

Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/wireless/b43/xmit.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index e85d34b76039..ebcce00ce067 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -810,9 +810,13 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
 		break;
 	case B43_PHYTYPE_G:
 		status.band = IEEE80211_BAND_2GHZ;
-		/* chanid is the radio channel cookie value as used
-		 * to tune the radio. */
-		status.freq = chanid + 2400;
+		/* Somewhere between 478.104 and 508.1084 firmware for G-PHY
+		 * has been modified to be compatible with N-PHY and others.
+		 */
+		if (dev->fw.rev >= 508)
+			status.freq = ieee80211_channel_to_frequency(chanid, status.band);
+		else
+			status.freq = chanid + 2400;
 		break;
 	case B43_PHYTYPE_N:
 	case B43_PHYTYPE_LP:
-- 
2.0.0


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

* [PATCH 3.12 107/170] CIFS: fix mount failure with broken pathnames when smb3 mount with mapchars option
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (105 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 106/170] b43: fix frequency reported on G-PHY with /new/ firmware Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 108/170] blkcg: fix use-after-free in __blkg_release_rcu() by making blkcg_gq refcnt an atomic_t Jiri Slaby
                   ` (63 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Steve French, Jiri Slaby

From: Steve French <smfrench@gmail.com>

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

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

commit ce36d9ab3bab06b7b5522f5c8b68fac231b76ffb upstream.

When we SMB3 mounted with mapchars (to allow reserved characters : \ / > < * ?
via the Unicode Windows to POSIX remap range) empty paths
(eg when we open "" to query the root of the SMB3 directory on mount) were not
null terminated so we sent garbarge as a path name on empty paths which caused
SMB2/SMB2.1/SMB3 mounts to fail when mapchars was specified.  mapchars is
particularly important since Unix Extensions for SMB3 are not supported (yet)

Signed-off-by: Steve French <smfrench@gmail.com>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/cifs/cifs_unicode.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c
index 0227b45ef00a..15e9505aa35f 100644
--- a/fs/cifs/cifs_unicode.c
+++ b/fs/cifs/cifs_unicode.c
@@ -290,7 +290,8 @@ int
 cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
 		 const struct nls_table *cp, int mapChars)
 {
-	int i, j, charlen;
+	int i, charlen;
+	int j = 0;
 	char src_char;
 	__le16 dst_char;
 	wchar_t tmp;
@@ -298,12 +299,11 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
 	if (!mapChars)
 		return cifs_strtoUTF16(target, source, PATH_MAX, cp);
 
-	for (i = 0, j = 0; i < srclen; j++) {
+	for (i = 0; i < srclen; j++) {
 		src_char = source[i];
 		charlen = 1;
 		switch (src_char) {
 		case 0:
-			put_unaligned(0, &target[j]);
 			goto ctoUTF16_out;
 		case ':':
 			dst_char = cpu_to_le16(UNI_COLON);
@@ -350,6 +350,7 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
 	}
 
 ctoUTF16_out:
+	put_unaligned(0, &target[j]); /* Null terminate target unicode string */
 	return j;
 }
 
-- 
2.0.0


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

* [PATCH 3.12 108/170] blkcg: fix use-after-free in __blkg_release_rcu() by making blkcg_gq refcnt an atomic_t
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (106 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 107/170] CIFS: fix mount failure with broken pathnames when smb3 mount with mapchars option Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 109/170] ext4: Fix buffer double free in ext4_alloc_branch() Jiri Slaby
                   ` (62 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Tejun Heo, Jens Axboe, Jiri Slaby

From: Tejun Heo <tj@kernel.org>

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

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

commit a5049a8ae34950249a7ae94c385d7c5c98914412 upstream.

Hello,

So, this patch should do.  Joe, Vivek, can one of you guys please
verify that the oops goes away with this patch?

Jens, the original thread can be read at

  http://thread.gmane.org/gmane.linux.kernel/1720729

The fix converts blkg->refcnt from int to atomic_t.  It does some
overhead but it should be minute compared to everything else which is
going on and the involved cacheline bouncing, so I think it's highly
unlikely to cause any noticeable difference.  Also, the refcnt in
question should be converted to a perpcu_ref for blk-mq anyway, so the
atomic_t is likely to go away pretty soon anyway.

Thanks.

------- 8< -------
__blkg_release_rcu() may be invoked after the associated request_queue
is released with a RCU grace period inbetween.  As such, the function
and callbacks invoked from it must not dereference the associated
request_queue.  This is clearly indicated in the comment above the
function.

Unfortunately, while trying to fix a different issue, 2a4fd070ee85
("blkcg: move bulk of blkcg_gq release operations to the RCU
callback") ignored this and added [un]locking of @blkg->q->queue_lock
to __blkg_release_rcu().  This of course can cause oops as the
request_queue may be long gone by the time this code gets executed.

  general protection fault: 0000 [#1] SMP
  CPU: 21 PID: 30 Comm: rcuos/21 Not tainted 3.15.0 #1
  Hardware name: Stratus ftServer 6400/G7LAZ, BIOS BIOS Version 6.3:57 12/25/2013
  task: ffff880854021de0 ti: ffff88085403c000 task.ti: ffff88085403c000
  RIP: 0010:[<ffffffff8162e9e5>]  [<ffffffff8162e9e5>] _raw_spin_lock_irq+0x15/0x60
  RSP: 0018:ffff88085403fdf0  EFLAGS: 00010086
  RAX: 0000000000020000 RBX: 0000000000000010 RCX: 0000000000000000
  RDX: 000060ef80008248 RSI: 0000000000000286 RDI: 6b6b6b6b6b6b6b6b
  RBP: ffff88085403fdf0 R08: 0000000000000286 R09: 0000000000009f39
  R10: 0000000000020001 R11: 0000000000020001 R12: ffff88103c17a130
  R13: ffff88103c17a080 R14: 0000000000000000 R15: 0000000000000000
  FS:  0000000000000000(0000) GS:ffff88107fca0000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 00000000006e5ab8 CR3: 000000000193d000 CR4: 00000000000407e0
  Stack:
   ffff88085403fe18 ffffffff812cbfc2 ffff88103c17a130 0000000000000000
   ffff88103c17a130 ffff88085403fec0 ffffffff810d1d28 ffff880854021de0
   ffff880854021de0 ffff88107fcaec58 ffff88085403fe80 ffff88107fcaec30
  Call Trace:
   [<ffffffff812cbfc2>] __blkg_release_rcu+0x72/0x150
   [<ffffffff810d1d28>] rcu_nocb_kthread+0x1e8/0x300
   [<ffffffff81091d81>] kthread+0xe1/0x100
   [<ffffffff8163813c>] ret_from_fork+0x7c/0xb0
  Code: ff 47 04 48 8b 7d 08 be 00 02 00 00 e8 55 48 a4 ff 5d c3 0f 1f 00 66 66 66 66 90 55 48 89 e5
  +fa 66 66 90 66 66 90 b8 00 00 02 00 <f0> 0f c1 07 89 c2 c1 ea 10 66 39 c2 75 02 5d c3 83 e2 fe 0f
  +b7
  RIP  [<ffffffff8162e9e5>] _raw_spin_lock_irq+0x15/0x60
   RSP <ffff88085403fdf0>

The request_queue locking was added because blkcg_gq->refcnt is an int
protected with the queue lock and __blkg_release_rcu() needs to put
the parent.  Let's fix it by making blkcg_gq->refcnt an atomic_t and
dropping queue locking in the function.

Given the general heavy weight of the current request_queue and blkcg
operations, this is unlikely to cause any noticeable overhead.
Moreover, blkcg_gq->refcnt is likely to be converted to percpu_ref in
the near future, so whatever (most likely negligible) overhead it may
add is temporary.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Joe Lawrence <joe.lawrence@stratus.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Link: http://lkml.kernel.org/g/alpine.DEB.2.02.1406081816540.17948@jlaw-desktop.mno.stratus.com
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 block/blk-cgroup.c |  7 ++-----
 block/blk-cgroup.h | 17 +++++++----------
 2 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 4e491d9b5292..dd0dd2d4ceca 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -80,7 +80,7 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q,
 	blkg->q = q;
 	INIT_LIST_HEAD(&blkg->q_node);
 	blkg->blkcg = blkcg;
-	blkg->refcnt = 1;
+	atomic_set(&blkg->refcnt, 1);
 
 	/* root blkg uses @q->root_rl, init rl only for !root blkgs */
 	if (blkcg != &blkcg_root) {
@@ -399,11 +399,8 @@ void __blkg_release_rcu(struct rcu_head *rcu_head)
 
 	/* release the blkcg and parent blkg refs this blkg has been holding */
 	css_put(&blkg->blkcg->css);
-	if (blkg->parent) {
-		spin_lock_irq(blkg->q->queue_lock);
+	if (blkg->parent)
 		blkg_put(blkg->parent);
-		spin_unlock_irq(blkg->q->queue_lock);
-	}
 
 	blkg_free(blkg);
 }
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 2e34c386d760..f1c1cfc92f41 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -18,6 +18,7 @@
 #include <linux/seq_file.h>
 #include <linux/radix-tree.h>
 #include <linux/blkdev.h>
+#include <linux/atomic.h>
 
 /* Max limits for throttle policy */
 #define THROTL_IOPS_MAX		UINT_MAX
@@ -104,7 +105,7 @@ struct blkcg_gq {
 	struct request_list		rl;
 
 	/* reference count */
-	int				refcnt;
+	atomic_t			refcnt;
 
 	/* is this blkg online? protected by both blkcg and q locks */
 	bool				online;
@@ -253,13 +254,12 @@ static inline int blkg_path(struct blkcg_gq *blkg, char *buf, int buflen)
  * blkg_get - get a blkg reference
  * @blkg: blkg to get
  *
- * The caller should be holding queue_lock and an existing reference.
+ * The caller should be holding an existing reference.
  */
 static inline void blkg_get(struct blkcg_gq *blkg)
 {
-	lockdep_assert_held(blkg->q->queue_lock);
-	WARN_ON_ONCE(!blkg->refcnt);
-	blkg->refcnt++;
+	WARN_ON_ONCE(atomic_read(&blkg->refcnt) <= 0);
+	atomic_inc(&blkg->refcnt);
 }
 
 void __blkg_release_rcu(struct rcu_head *rcu);
@@ -267,14 +267,11 @@ void __blkg_release_rcu(struct rcu_head *rcu);
 /**
  * blkg_put - put a blkg reference
  * @blkg: blkg to put
- *
- * The caller should be holding queue_lock.
  */
 static inline void blkg_put(struct blkcg_gq *blkg)
 {
-	lockdep_assert_held(blkg->q->queue_lock);
-	WARN_ON_ONCE(blkg->refcnt <= 0);
-	if (!--blkg->refcnt)
+	WARN_ON_ONCE(atomic_read(&blkg->refcnt) <= 0);
+	if (atomic_dec_and_test(&blkg->refcnt))
 		call_rcu(&blkg->rcu_head, __blkg_release_rcu);
 }
 
-- 
2.0.0


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

* [PATCH 3.12 109/170] ext4: Fix buffer double free in ext4_alloc_branch()
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (107 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 108/170] blkcg: fix use-after-free in __blkg_release_rcu() by making blkcg_gq refcnt an atomic_t Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 110/170] ext4: Fix hole punching for files with indirect blocks Jiri Slaby
                   ` (61 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jan Kara, Theodore Ts'o, Jiri Slaby

From: Jan Kara <jack@suse.cz>

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

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

commit c5c7b8ddfbf8cb3b2291e515a34ab1b8982f5a2d upstream.

Error recovery in ext4_alloc_branch() calls ext4_forget() even for
buffer corresponding to indirect block it did not allocate. This leads
to brelse() being called twice for that buffer (once from ext4_forget()
and once from cleanup in ext4_ind_map_blocks()) leading to buffer use
count misaccounting. Eventually (but often much later because there
are other users of the buffer) we will see messages like:
VFS: brelse: Trying to free free buffer

Another manifestation of this problem is an error:
JBD2 unexpected failure: jbd2_journal_revoke: !buffer_revoked(bh);
inconsistent data on disk

The fix is easy - don't forget buffer we did not allocate. Also add an
explanatory comment because the indexing at ext4_alloc_branch() is
somewhat subtle.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/ext4/indirect.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
index 594009f5f523..3b91d240da4d 100644
--- a/fs/ext4/indirect.c
+++ b/fs/ext4/indirect.c
@@ -389,7 +389,13 @@ static int ext4_alloc_branch(handle_t *handle, struct inode *inode,
 	return 0;
 failed:
 	for (; i >= 0; i--) {
-		if (i != indirect_blks && branch[i].bh)
+		/*
+		 * We want to ext4_forget() only freshly allocated indirect
+		 * blocks.  Buffer for new_blocks[i-1] is at branch[i].bh and
+		 * buffer at branch[0].bh is indirect block / inode already
+		 * existing before ext4_alloc_branch() was called.
+		 */
+		if (i > 0 && i != indirect_blks && branch[i].bh)
 			ext4_forget(handle, 1, inode, branch[i].bh,
 				    branch[i].bh->b_blocknr);
 		ext4_free_blocks(handle, inode, NULL, new_blocks[i],
-- 
2.0.0


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

* [PATCH 3.12 110/170] ext4: Fix hole punching for files with indirect blocks
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (108 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 109/170] ext4: Fix buffer double free in ext4_alloc_branch() Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 111/170] KVM: x86: Increase the number of fixed MTRR regs to 10 Jiri Slaby
                   ` (60 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jan Kara, Theodore Ts'o, Jiri Slaby

From: Jan Kara <jack@suse.cz>

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

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

commit a93cd4cf86466caa49cfe64607bea7f0bde3f916 upstream.

Hole punching code for files with indirect blocks wrongly computed
number of blocks which need to be cleared when traversing the indirect
block tree. That could result in punching more blocks than actually
requested and thus effectively cause a data loss. For example:

fallocate -n -p 10240000 4096

will punch the range 10240000 - 12632064 instead of the range 1024000 -
10244096. Fix the calculation.

Fixes: 8bad6fc813a3a5300f51369c39d315679fd88c72
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/ext4/indirect.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
index 3b91d240da4d..e6574d7b6642 100644
--- a/fs/ext4/indirect.c
+++ b/fs/ext4/indirect.c
@@ -1318,16 +1318,24 @@ static int free_hole_blocks(handle_t *handle, struct inode *inode,
 		blk = *i_data;
 		if (level > 0) {
 			ext4_lblk_t first2;
+			ext4_lblk_t count2;
+
 			bh = sb_bread(inode->i_sb, le32_to_cpu(blk));
 			if (!bh) {
 				EXT4_ERROR_INODE_BLOCK(inode, le32_to_cpu(blk),
 						       "Read failure");
 				return -EIO;
 			}
-			first2 = (first > offset) ? first - offset : 0;
+			if (first > offset) {
+				first2 = first - offset;
+				count2 = count;
+			} else {
+				first2 = 0;
+				count2 = count - (offset - first);
+			}
 			ret = free_hole_blocks(handle, inode, bh,
 					       (__le32 *)bh->b_data, level - 1,
-					       first2, count - offset,
+					       first2, count2,
 					       inode->i_sb->s_blocksize >> 2);
 			if (ret) {
 				brelse(bh);
-- 
2.0.0


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

* [PATCH 3.12 111/170] KVM: x86: Increase the number of fixed MTRR regs to 10
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (109 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 110/170] ext4: Fix hole punching for files with indirect blocks Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 112/170] KVM: x86: preserve the high 32-bits of the PAT register Jiri Slaby
                   ` (59 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Nadav Amit, Paolo Bonzini, Jiri Slaby

From: Nadav Amit <namit@cs.technion.ac.il>

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

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

commit 682367c494869008eb89ef733f196e99415ae862 upstream.

Recent Intel CPUs have 10 variable range MTRRs. Since operating systems
sometime make assumptions on CPUs while they ignore capability MSRs, it is
better for KVM to be consistent with recent CPUs. Reporting more MTRRs than
actually supported has no functional implications.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/include/asm/kvm_host.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index c76ff74a98f2..792206c8e555 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -92,7 +92,7 @@
 #define KVM_REFILL_PAGES 25
 #define KVM_MAX_CPUID_ENTRIES 80
 #define KVM_NR_FIXED_MTRR_REGION 88
-#define KVM_NR_VAR_MTRR 8
+#define KVM_NR_VAR_MTRR 10
 
 #define ASYNC_PF_PER_VCPU 64
 
-- 
2.0.0


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

* [PATCH 3.12 112/170] KVM: x86: preserve the high 32-bits of the PAT register
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (110 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 111/170] KVM: x86: Increase the number of fixed MTRR regs to 10 Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 113/170] iio: of_iio_channel_get_by_name() returns non-null pointers for error legs Jiri Slaby
                   ` (58 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 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 7cb060a91c0efc5ff94f83c6df3ed705e143cdb9 upstream.

KVM does not really do much with the PAT, so this went unnoticed for a
long time.  It is exposed however if you try to do rdmsr on the PAT
register.

Reported-by: Valentine Sinitsyn <valentine.sinitsyn@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/include/asm/kvm_host.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 792206c8e555..694851592399 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -455,7 +455,7 @@ struct kvm_vcpu_arch {
 	bool nmi_injected;    /* Trying to inject an NMI this entry */
 
 	struct mtrr_state_type mtrr_state;
-	u32 pat;
+	u64 pat;
 
 	int switch_db_regs;
 	unsigned long db[KVM_NR_DB_REGS];
-- 
2.0.0


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

* [PATCH 3.12 113/170] iio: of_iio_channel_get_by_name() returns non-null pointers for error legs
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (111 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 112/170] KVM: x86: preserve the high 32-bits of the PAT register Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:11 ` [PATCH 3.12 114/170] nfsd: fix rare symlink decoding bug Jiri Slaby
                   ` (57 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Adam Thomson, Jonathan Cameron, Jiri Slaby

From: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

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

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

commit a2c12493ed7e63a18cef33a71686d12ffcd6600e upstream.

Currently in the inkern.c code for IIO framework, the function
of_iio_channel_get_by_name() will return a non-NULL pointer when
it cannot find a channel using of_iio_channel_get() and when it
tries to search for 'io-channel-ranges' property and fails. This
is incorrect behaviour as the function which calls this expects
a NULL pointer for failure. This patch rectifies the issue.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/iio/inkern.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index 0cf5f8e06cfc..1e8e94d4db7d 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -183,7 +183,7 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np,
 		else if (name && index >= 0) {
 			pr_err("ERROR: could not get IIO channel %s:%s(%i)\n",
 				np->full_name, name ? name : "", index);
-			return chan;
+			return NULL;
 		}
 
 		/*
@@ -193,8 +193,9 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np,
 		 */
 		np = np->parent;
 		if (np && !of_get_property(np, "io-channel-ranges", NULL))
-			break;
+			return NULL;
 	}
+
 	return chan;
 }
 
@@ -317,6 +318,7 @@ struct iio_channel *iio_channel_get(struct device *dev,
 		if (channel != NULL)
 			return channel;
 	}
+
 	return iio_channel_get_sys(name, channel_name);
 }
 EXPORT_SYMBOL_GPL(iio_channel_get);
-- 
2.0.0


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

* [PATCH 3.12 114/170] nfsd: fix rare symlink decoding bug
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (112 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 113/170] iio: of_iio_channel_get_by_name() returns non-null pointers for error legs Jiri Slaby
@ 2014-07-18 12:11 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 115/170] tools: ffs-test: fix header values endianess Jiri Slaby
                   ` (56 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:11 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, J. Bruce Fields, Jiri Slaby

From: "J. Bruce Fields" <bfields@redhat.com>

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

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

commit 76f47128f9b33af1e96819746550d789054c9664 upstream.

An NFS operation that creates a new symlink includes the symlink data,
which is xdr-encoded as a length followed by the data plus 0 to 3 bytes
of zero-padding as required to reach a 4-byte boundary.

The vfs, on the other hand, wants null-terminated data.

The simple way to handle this would be by copying the data into a newly
allocated buffer with space for the final null.

The current nfsd_symlink code tries to be more clever by skipping that
step in the (likely) case where the byte following the string is already
0.

But that assumes that the byte following the string is ours to look at.
In fact, it might be the first byte of a page that we can't read, or of
some object that another task might modify.

Worse, the NFSv4 code tries to fix the problem by actually writing to
that byte.

In the NFSv2/v3 cases this actually appears to be safe:

	- nfs3svc_decode_symlinkargs explicitly null-terminates the data
	  (after first checking its length and copying it to a new
	  page).
	- NFSv2 limits symlinks to 1k.  The buffer holding the rpc
	  request is always at least a page, and the link data (and
	  previous fields) have maximum lengths that prevent the request
	  from reaching the end of a page.

In the NFSv4 case the CREATE op is potentially just one part of a long
compound so can end up on the end of a page if you're unlucky.

The minimal fix here is to copy and null-terminate in the NFSv4 case.
The nfsd_symlink() interface here seems too fragile, though.  It should
really either do the copy itself every time or just require a
null-terminated string.

Reported-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nfsd/nfs4proc.c |  9 ---------
 fs/nfsd/nfs4xdr.c  | 13 ++++++++++++-
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index b9e784486729..08c8e023c157 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -610,15 +610,6 @@ nfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 
 	switch (create->cr_type) {
 	case NF4LNK:
-		/* ugh! we have to null-terminate the linktext, or
-		 * vfs_symlink() will choke.  it is always safe to
-		 * null-terminate by brute force, since at worst we
-		 * will overwrite the first byte of the create namelen
-		 * in the XDR buffer, which has already been extracted
-		 * during XDR decode.
-		 */
-		create->cr_linkname[create->cr_linklen] = 0;
-
 		status = nfsd_symlink(rqstp, &cstate->current_fh,
 				      create->cr_name, create->cr_namelen,
 				      create->cr_linkname, create->cr_linklen,
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 8fb749d7bbe6..42c8c8aeb465 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -594,7 +594,18 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create
 		READ_BUF(4);
 		READ32(create->cr_linklen);
 		READ_BUF(create->cr_linklen);
-		SAVEMEM(create->cr_linkname, create->cr_linklen);
+		/*
+		 * The VFS will want a null-terminated string, and
+		 * null-terminating in place isn't safe since this might
+		 * end on a page boundary:
+		 */
+		create->cr_linkname =
+				kmalloc(create->cr_linklen + 1, GFP_KERNEL);
+		if (!create->cr_linkname)
+			return nfserr_jukebox;
+		memcpy(create->cr_linkname, p, create->cr_linklen);
+		create->cr_linkname[create->cr_linklen] = '\0';
+		defer_free(argp, kfree, create->cr_linkname);
 		break;
 	case NF4BLK:
 	case NF4CHR:
-- 
2.0.0


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

* [PATCH 3.12 115/170] tools: ffs-test: fix header values endianess
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (113 preceding siblings ...)
  2014-07-18 12:11 ` [PATCH 3.12 114/170] nfsd: fix rare symlink decoding bug Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 116/170] tracing: Remove ftrace_stop/start() from reading the trace file Jiri Slaby
                   ` (55 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Michal Nazarewicz, Felipe Balbi, Jiri Slaby

From: Michal Nazarewicz <mina86@mina86.com>

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

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

commit f35f71244da6e51db4e1f2c7e318581f498ececf upstream.

It appears that no one ever run ffs-test on a big-endian machine,
since it used cpu-endianess for fs_count and hs_count fields which
should be in little-endian format.  Fix by wrapping the numbers in
cpu_to_le32.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 tools/usb/ffs-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c
index fe1e66b6ef40..a87e99f37c52 100644
--- a/tools/usb/ffs-test.c
+++ b/tools/usb/ffs-test.c
@@ -116,8 +116,8 @@ static const struct {
 	.header = {
 		.magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC),
 		.length = cpu_to_le32(sizeof descriptors),
-		.fs_count = 3,
-		.hs_count = 3,
+		.fs_count = cpu_to_le32(3),
+		.hs_count = cpu_to_le32(3),
 	},
 	.fs_descs = {
 		.intf = {
-- 
2.0.0


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

* [PATCH 3.12 116/170] tracing: Remove ftrace_stop/start() from reading the trace file
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (114 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 115/170] tools: ffs-test: fix header values endianess Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 117/170] md: flush writes before starting a recovery Jiri Slaby
                   ` (54 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Steven Rostedt (Red Hat), Jiri Slaby

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

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

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

commit 099ed151675cd1d2dbeae1dac697975f6a68716d upstream.

Disabling reading and writing to the trace file should not be able to
disable all function tracing callbacks. There's other users today
(like kprobes and perf). Reading a trace file should not stop those
from happening.

Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/trace/trace.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 24a74162e76f..57d7c64bb980 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1323,7 +1323,6 @@ void tracing_start(void)
 
 	arch_spin_unlock(&ftrace_max_lock);
 
-	ftrace_start();
  out:
 	raw_spin_unlock_irqrestore(&global_trace.start_lock, flags);
 }
@@ -1370,7 +1369,6 @@ void tracing_stop(void)
 	struct ring_buffer *buffer;
 	unsigned long flags;
 
-	ftrace_stop();
 	raw_spin_lock_irqsave(&global_trace.start_lock, flags);
 	if (global_trace.stop_count++)
 		goto out;
-- 
2.0.0


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

* [PATCH 3.12 117/170] md: flush writes before starting a recovery.
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (115 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 116/170] tracing: Remove ftrace_stop/start() from reading the trace file Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 118/170] irqchip: spear_shirq: Fix interrupt offset Jiri Slaby
                   ` (53 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 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 133d4527eab8d199a62eee6bd433f0776842df2e upstream.

When we write to a degraded array which has a bitmap, we
make sure the relevant bit in the bitmap remains set when
the write completes (so a 're-add' can quickly rebuilt a
temporarily-missing device).

If, immediately after such a write starts, we incorporate a spare,
commence recovery, and skip over the region where the write is
happening (because the 'needs recovery' flag isn't set yet),
then that write will not get to the new device.

Once the recovery finishes the new device will be trusted, but will
have incorrect data, leading to possible corruption.

We cannot set the 'needs recovery' flag when we start the write as we
do not know easily if the write will be "degraded" or not.  That
depends on details of the particular raid level and particular write
request.

This patch fixes a corruption issue of long standing and so it
suitable for any -stable kernel.  It applied correctly to 3.0 at
least and will minor editing to earlier kernels.

Reported-by: Bill <billstuff2001@sbcglobal.net>
Tested-by: Bill <billstuff2001@sbcglobal.net>
Link: http://lkml.kernel.org/r/53A518BB.60709@sbcglobal.net
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/md/md.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index c98e681fc9fc..bf030d4b09a7 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7484,6 +7484,19 @@ void md_do_sync(struct md_thread *thread)
 			    rdev->recovery_offset < j)
 				j = rdev->recovery_offset;
 		rcu_read_unlock();
+
+		/* If there is a bitmap, we need to make sure all
+		 * writes that started before we added a spare
+		 * complete before we start doing a recovery.
+		 * Otherwise the write might complete and (via
+		 * bitmap_endwrite) set a bit in the bitmap after the
+		 * recovery has checked that bit and skipped that
+		 * region.
+		 */
+		if (mddev->bitmap) {
+			mddev->pers->quiesce(mddev, 1);
+			mddev->pers->quiesce(mddev, 0);
+		}
 	}
 
 	printk(KERN_INFO "md: %s of RAID array %s\n", desc, mdname(mddev));
-- 
2.0.0


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

* [PATCH 3.12 118/170] irqchip: spear_shirq: Fix interrupt offset
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (116 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 117/170] md: flush writes before starting a recovery Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 119/170] mm: page_alloc: fix CMA area initialisation when pageblock > MAX_ORDER Jiri Slaby
                   ` (52 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Thomas Gleixner, Jason Cooper, Jiri Slaby

From: Thomas Gleixner <tglx@linutronix.de>

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

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

commit 4f4366033945419b0c52118c29d3057d7c558765 upstream.

The ras3 block on spear320 claims to have 3 interrupts. In fact it has
one and 6 reserved interrupts. Account the 6 reserved to this block so
it has 7 interrupts total. That matches the datasheet and the device
tree entries.

Broken since commit 80515a5a(ARM: SPEAr3xx: shirq: simplify and move
the shared irq multiplexor to DT). Testing is overrated....

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20140619212712.872379208@linutronix.de
Fixes: 80515a5a2e3c ('ARM: SPEAr3xx: shirq: simplify and move the shared irq multiplexor to DT')
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/irqchip/spear-shirq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/spear-shirq.c b/drivers/irqchip/spear-shirq.c
index 8527743b5cef..391b9cea73ed 100644
--- a/drivers/irqchip/spear-shirq.c
+++ b/drivers/irqchip/spear-shirq.c
@@ -125,7 +125,7 @@ static struct spear_shirq spear320_shirq_ras2 = {
 };
 
 static struct spear_shirq spear320_shirq_ras3 = {
-	.irq_nr = 3,
+	.irq_nr = 7,
 	.irq_bit_off = 0,
 	.invalid_irq = 1,
 	.regs = {
-- 
2.0.0


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

* [PATCH 3.12 119/170] mm: page_alloc: fix CMA area initialisation when pageblock > MAX_ORDER
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (117 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 118/170] irqchip: spear_shirq: Fix interrupt offset Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 120/170] serial: Fix IGNBRK handling Jiri Slaby
                   ` (51 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Michal Nazarewicz, Mel Gorman, David Rientjes,
	Marek Szyprowski, Catalin Marinas, Andrew Morton, Linus Torvalds,
	Jiri Slaby

From: Michal Nazarewicz <mina86@mina86.com>

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

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

commit dc78327c0ea7da5186d8cbc1647bd6088c5c9fa5 upstream.

With a kernel configured with ARM64_64K_PAGES && !TRANSPARENT_HUGEPAGE,
the following is triggered at early boot:

  SMP: Total of 8 processors activated.
  devtmpfs: initialized
  Unable to handle kernel NULL pointer dereference at virtual address 00000008
  pgd = fffffe0000050000
  [00000008] *pgd=00000043fba00003, *pmd=00000043fba00003, *pte=00e0000078010407
  Internal error: Oops: 96000006 [#1] SMP
  Modules linked in:
  CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.15.0-rc864k+ #44
  task: fffffe03bc040000 ti: fffffe03bc080000 task.ti: fffffe03bc080000
  PC is at __list_add+0x10/0xd4
  LR is at free_one_page+0x270/0x638
  ...
  Call trace:
    __list_add+0x10/0xd4
    free_one_page+0x26c/0x638
    __free_pages_ok.part.52+0x84/0xbc
    __free_pages+0x74/0xbc
    init_cma_reserved_pageblock+0xe8/0x104
    cma_init_reserved_areas+0x190/0x1e4
    do_one_initcall+0xc4/0x154
    kernel_init_freeable+0x204/0x2a8
    kernel_init+0xc/0xd4

This happens because init_cma_reserved_pageblock() calls
__free_one_page() with pageblock_order as page order but it is bigger
than MAX_ORDER.  This in turn causes accesses past zone->free_list[].

Fix the problem by changing init_cma_reserved_pageblock() such that it
splits pageblock into individual MAX_ORDER pages if pageblock is bigger
than a MAX_ORDER page.

In cases where !CONFIG_HUGETLB_PAGE_SIZE_VARIABLE, which is all
architectures expect for ia64, powerpc and tile at the moment, the
“pageblock_order > MAX_ORDER” condition will be optimised out since both
sides of the operator are constants.  In cases where pageblock size is
variable, the performance degradation should not be significant anyway
since init_cma_reserved_pageblock() is called only at boot time at most
MAX_CMA_AREAS times which by default is eight.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Reported-by: Mark Salter <msalter@redhat.com>
Tested-by: Mark Salter <msalter@redhat.com>
Tested-by: Christopher Covington <cov@codeaurora.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: David Rientjes <rientjes@google.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Catalin Marinas <catalin.marinas@arm.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/page_alloc.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 83aaa49bcba7..6e0a9cf8d02a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -785,9 +785,21 @@ void __init init_cma_reserved_pageblock(struct page *page)
 		set_page_count(p, 0);
 	} while (++p, --i);
 
-	set_page_refcounted(page);
 	set_pageblock_migratetype(page, MIGRATE_CMA);
-	__free_pages(page, pageblock_order);
+
+	if (pageblock_order >= MAX_ORDER) {
+		i = pageblock_nr_pages;
+		p = page;
+		do {
+			set_page_refcounted(p);
+			__free_pages(p, MAX_ORDER - 1);
+			p += MAX_ORDER_NR_PAGES;
+		} while (i -= MAX_ORDER_NR_PAGES);
+	} else {
+		set_page_refcounted(page);
+		__free_pages(page, pageblock_order);
+	}
+
 	adjust_managed_page_count(page, pageblock_nr_pages);
 }
 #endif
-- 
2.0.0


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

* [PATCH 3.12 120/170] serial: Fix IGNBRK handling
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (118 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 119/170] mm: page_alloc: fix CMA area initialisation when pageblock > MAX_ORDER Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 121/170] tty: Correct INPCK handling Jiri Slaby
                   ` (50 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Peter Hurley, Jiri Slaby

From: Peter Hurley <peter@hurleysoftware.com>

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

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

commit ef8b9ddcb45fa3b1e11acd72be2398001e807d14 upstream.

If IGNBRK is set without either BRKINT or PARMRK set, some uart
drivers send a 0x00 byte for BREAK without the TTYBREAK flag to the
line discipline, when it should send either nothing or the TTYBREAK flag
set. This happens because the read_status_mask masks out the BI
condition, which uart_insert_char() then interprets as a normal 0x00 byte.

SUS v3 is clear regarding the meaning of IGNBRK; Section 11.2.2, General
Terminal Interface - Input Modes, states:
  "If IGNBRK is set, a break condition detected on input shall be ignored;
   that is, not put on the input queue and therefore not read by any
   process."

Fix read_status_mask to include the BI bit if IGNBRK is set; the
lsr status retains the BI bit if a BREAK is recv'd, which is
subsequently ignored in uart_insert_char() when masked with the
ignore_status_mask.

Affected drivers:
8250 - all
serial_txx9
mfd
amba-pl010
amba-pl011
atmel_serial
bfin_uart
dz
ip22zilog
max310x
mxs-auart
netx-serial
pnx8xxx_uart
pxa
sb1250-duart
sccnxp
serial_ks8695
sirfsoc_uart
st-asc
vr41xx_siu
zs
sunzilog
fsl_lpuart
sunsab
ucc_uart
bcm63xx_uart
sunsu
efm32-uart
pmac_zilog
mpsc
msm_serial
m32r_sio

Unaffected drivers:
omap-serial
rp2
sa1100
imx
icom

Annotated for fixes:
altera_uart
mcf

Drivers without break detection:
21285
xilinx-uartps
altera_jtaguart
apbuart
arc-uart
clps711x
max3100
uartlite
msm_serial_hs
nwpserial
lantiq
vt8500_serial

Unknown:
samsung
mpc52xx_uart
bfin_sport_uart
cpm_uart/core

Fixes: Bugzilla #71651, '8250_core.c incorrectly handles IGNBRK flag'
Reported-by: Ivan <athlon_@mail.ru>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/serial/8250/8250_core.c | 2 +-
 drivers/tty/serial/altera_uart.c    | 6 ++++++
 drivers/tty/serial/amba-pl010.c     | 2 +-
 drivers/tty/serial/amba-pl011.c     | 2 +-
 drivers/tty/serial/atmel_serial.c   | 2 +-
 drivers/tty/serial/bcm63xx_uart.c   | 2 +-
 drivers/tty/serial/bfin_uart.c      | 2 +-
 drivers/tty/serial/dz.c             | 2 +-
 drivers/tty/serial/efm32-uart.c     | 2 +-
 drivers/tty/serial/fsl_lpuart.c     | 2 +-
 drivers/tty/serial/ip22zilog.c      | 2 +-
 drivers/tty/serial/m32r_sio.c       | 2 +-
 drivers/tty/serial/max310x.c        | 2 +-
 drivers/tty/serial/mcf.c            | 6 ++++++
 drivers/tty/serial/mfd.c            | 2 +-
 drivers/tty/serial/mpsc.c           | 2 +-
 drivers/tty/serial/msm_serial.c     | 2 +-
 drivers/tty/serial/mxs-auart.c      | 2 +-
 drivers/tty/serial/netx-serial.c    | 2 +-
 drivers/tty/serial/pmac_zilog.c     | 2 +-
 drivers/tty/serial/pnx8xxx_uart.c   | 2 +-
 drivers/tty/serial/pxa.c            | 2 +-
 drivers/tty/serial/sb1250-duart.c   | 2 +-
 drivers/tty/serial/sccnxp.c         | 2 +-
 drivers/tty/serial/serial_ks8695.c  | 2 +-
 drivers/tty/serial/serial_txx9.c    | 2 +-
 drivers/tty/serial/sirfsoc_uart.c   | 2 +-
 drivers/tty/serial/st-asc.c         | 2 +-
 drivers/tty/serial/sunsab.c         | 2 +-
 drivers/tty/serial/sunsu.c          | 2 +-
 drivers/tty/serial/sunzilog.c       | 2 +-
 drivers/tty/serial/ucc_uart.c       | 2 +-
 drivers/tty/serial/vr41xx_siu.c     | 2 +-
 drivers/tty/serial/zs.c             | 2 +-
 34 files changed, 44 insertions(+), 32 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index bf9d2ac9c9ed..04c8772639d3 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -2356,7 +2356,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,
 	port->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR;
 	if (termios->c_iflag & INPCK)
 		port->read_status_mask |= UART_LSR_FE | UART_LSR_PE;
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		port->read_status_mask |= UART_LSR_BI;
 
 	/*
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c
index 501667e3e3f5..323376668b72 100644
--- a/drivers/tty/serial/altera_uart.c
+++ b/drivers/tty/serial/altera_uart.c
@@ -185,6 +185,12 @@ static void altera_uart_set_termios(struct uart_port *port,
 	uart_update_timeout(port, termios->c_cflag, baud);
 	altera_uart_writel(port, baudclk, ALTERA_UART_DIVISOR_REG);
 	spin_unlock_irqrestore(&port->lock, flags);
+
+	/*
+	 * FIXME: port->read_status_mask and port->ignore_status_mask
+	 * need to be initialized based on termios settings for
+	 * INPCK, IGNBRK, IGNPAR, PARMRK, BRKINT
+	 */
 }
 
 static void altera_uart_rx_chars(struct altera_uart *pp)
diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c
index 8b90f0b6dfdf..40bff818b947 100644
--- a/drivers/tty/serial/amba-pl010.c
+++ b/drivers/tty/serial/amba-pl010.c
@@ -420,7 +420,7 @@ pl010_set_termios(struct uart_port *port, struct ktermios *termios,
 	uap->port.read_status_mask = UART01x_RSR_OE;
 	if (termios->c_iflag & INPCK)
 		uap->port.read_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE;
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		uap->port.read_status_mask |= UART01x_RSR_BE;
 
 	/*
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 1440d0b4a7bc..a976ba99a006 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1731,7 +1731,7 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios,
 	port->read_status_mask = UART011_DR_OE | 255;
 	if (termios->c_iflag & INPCK)
 		port->read_status_mask |= UART011_DR_FE | UART011_DR_PE;
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		port->read_status_mask |= UART011_DR_BE;
 
 	/*
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 41bb8387e80d..3b301a7ec662 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1794,7 +1794,7 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
 	port->read_status_mask = ATMEL_US_OVRE;
 	if (termios->c_iflag & INPCK)
 		port->read_status_mask |= (ATMEL_US_FRAME | ATMEL_US_PARE);
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		port->read_status_mask |= ATMEL_US_RXBRK;
 
 	if (atmel_use_pdc_rx(port))
diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
index 649d5129c4b4..88b07adedaef 100644
--- a/drivers/tty/serial/bcm63xx_uart.c
+++ b/drivers/tty/serial/bcm63xx_uart.c
@@ -568,7 +568,7 @@ static void bcm_uart_set_termios(struct uart_port *port,
 		port->read_status_mask |= UART_FIFO_FRAMEERR_MASK;
 		port->read_status_mask |= UART_FIFO_PARERR_MASK;
 	}
-	if (new->c_iflag & (BRKINT))
+	if (new->c_iflag & (IGNBRK | BRKINT))
 		port->read_status_mask |= UART_FIFO_BRKDET_MASK;
 
 	port->ignore_status_mask = 0;
diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c
index 3c75e8e04028..8d3046909c23 100644
--- a/drivers/tty/serial/bfin_uart.c
+++ b/drivers/tty/serial/bfin_uart.c
@@ -833,7 +833,7 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
 	port->read_status_mask = OE;
 	if (termios->c_iflag & INPCK)
 		port->read_status_mask |= (FE | PE);
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		port->read_status_mask |= BI;
 
 	/*
diff --git a/drivers/tty/serial/dz.c b/drivers/tty/serial/dz.c
index 2f2b2e538a54..cdbbc788230a 100644
--- a/drivers/tty/serial/dz.c
+++ b/drivers/tty/serial/dz.c
@@ -625,7 +625,7 @@ static void dz_set_termios(struct uart_port *uport, struct ktermios *termios,
 	dport->port.read_status_mask = DZ_OERR;
 	if (termios->c_iflag & INPCK)
 		dport->port.read_status_mask |= DZ_FERR | DZ_PERR;
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		dport->port.read_status_mask |= DZ_BREAK;
 
 	/* characters to ignore */
diff --git a/drivers/tty/serial/efm32-uart.c b/drivers/tty/serial/efm32-uart.c
index 0eb5b5673ede..948f17b6b497 100644
--- a/drivers/tty/serial/efm32-uart.c
+++ b/drivers/tty/serial/efm32-uart.c
@@ -407,7 +407,7 @@ static void efm32_uart_set_termios(struct uart_port *port,
 	if (new->c_iflag & INPCK)
 		port->read_status_mask |=
 			UARTn_RXDATAX_FERR | UARTn_RXDATAX_PERR;
-	if (new->c_iflag & (BRKINT | PARMRK))
+	if (new->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		port->read_status_mask |= SW_UARTn_RXDATAX_BERR;
 
 	port->ignore_status_mask = 0;
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 8978dc9a58b7..175f123f4f09 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -496,7 +496,7 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios,
 	sport->port.read_status_mask = 0;
 	if (termios->c_iflag & INPCK)
 		sport->port.read_status_mask |=	(UARTSR1_FE | UARTSR1_PE);
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		sport->port.read_status_mask |= UARTSR1_FE;
 
 	/* characters to ignore */
diff --git a/drivers/tty/serial/ip22zilog.c b/drivers/tty/serial/ip22zilog.c
index cb3c81eb0996..a90f4089d080 100644
--- a/drivers/tty/serial/ip22zilog.c
+++ b/drivers/tty/serial/ip22zilog.c
@@ -850,7 +850,7 @@ ip22zilog_convert_to_zs(struct uart_ip22zilog_port *up, unsigned int cflag,
 	up->port.read_status_mask = Rx_OVR;
 	if (iflag & INPCK)
 		up->port.read_status_mask |= CRC_ERR | PAR_ERR;
-	if (iflag & (BRKINT | PARMRK))
+	if (iflag & (IGNBRK | BRKINT | PARMRK))
 		up->port.read_status_mask |= BRK_ABRT;
 
 	up->port.ignore_status_mask = 0;
diff --git a/drivers/tty/serial/m32r_sio.c b/drivers/tty/serial/m32r_sio.c
index 9cd9b4eba9fc..68f2c53e0b54 100644
--- a/drivers/tty/serial/m32r_sio.c
+++ b/drivers/tty/serial/m32r_sio.c
@@ -737,7 +737,7 @@ static void m32r_sio_set_termios(struct uart_port *port,
 	up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR;
 	if (termios->c_iflag & INPCK)
 		up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE;
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		up->port.read_status_mask |= UART_LSR_BI;
 
 	/*
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index b2e707aa603a..518364311b75 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -842,7 +842,7 @@ static void max310x_set_termios(struct uart_port *port,
 	if (termios->c_iflag & INPCK)
 		port->read_status_mask |= MAX310X_LSR_RXPAR_BIT |
 					  MAX310X_LSR_FRERR_BIT;
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		port->read_status_mask |= MAX310X_LSR_RXBRK_BIT;
 
 	/* Set status ignore mask */
diff --git a/drivers/tty/serial/mcf.c b/drivers/tty/serial/mcf.c
index 0edfaf8cd269..a6f085717f94 100644
--- a/drivers/tty/serial/mcf.c
+++ b/drivers/tty/serial/mcf.c
@@ -248,6 +248,12 @@ static void mcf_set_termios(struct uart_port *port, struct ktermios *termios,
 		mr1 |= MCFUART_MR1_PARITYNONE;
 	}
 
+	/*
+	 * FIXME: port->read_status_mask and port->ignore_status_mask
+	 * need to be initialized based on termios settings for
+	 * INPCK, IGNBRK, IGNPAR, PARMRK, BRKINT
+	 */
+
 	if (termios->c_cflag & CSTOPB)
 		mr2 |= MCFUART_MR2_STOP2;
 	else
diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c
index d3db042f649e..81ad559ee9cb 100644
--- a/drivers/tty/serial/mfd.c
+++ b/drivers/tty/serial/mfd.c
@@ -975,7 +975,7 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios,
 	up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR;
 	if (termios->c_iflag & INPCK)
 		up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE;
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		up->port.read_status_mask |= UART_LSR_BI;
 
 	/* Characters to ignore */
diff --git a/drivers/tty/serial/mpsc.c b/drivers/tty/serial/mpsc.c
index 8d702677acc5..76749f404b68 100644
--- a/drivers/tty/serial/mpsc.c
+++ b/drivers/tty/serial/mpsc.c
@@ -1458,7 +1458,7 @@ static void mpsc_set_termios(struct uart_port *port, struct ktermios *termios,
 		pi->port.read_status_mask |= SDMA_DESC_CMDSTAT_PE
 			| SDMA_DESC_CMDSTAT_FR;
 
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		pi->port.read_status_mask |= SDMA_DESC_CMDSTAT_BR;
 
 	/* Characters/events to ignore */
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index b5d779cd3c2b..c0f2b3e5452f 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -570,7 +570,7 @@ static void msm_set_termios(struct uart_port *port, struct ktermios *termios,
 	port->read_status_mask = 0;
 	if (termios->c_iflag & INPCK)
 		port->read_status_mask |= UART_SR_PAR_FRAME_ERR;
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		port->read_status_mask |= UART_SR_RX_BREAK;
 
 	uart_update_timeout(port, termios->c_cflag, baud);
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index 10e9d70b5c40..ea96c39b387d 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -600,7 +600,7 @@ static void mxs_auart_settermios(struct uart_port *u,
 
 	if (termios->c_iflag & INPCK)
 		u->read_status_mask |= AUART_STAT_PERR;
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		u->read_status_mask |= AUART_STAT_BERR;
 
 	/*
diff --git a/drivers/tty/serial/netx-serial.c b/drivers/tty/serial/netx-serial.c
index 0a4dd70d29eb..7a6745601d4e 100644
--- a/drivers/tty/serial/netx-serial.c
+++ b/drivers/tty/serial/netx-serial.c
@@ -419,7 +419,7 @@ netx_set_termios(struct uart_port *port, struct ktermios *termios,
 	}
 
 	port->read_status_mask = 0;
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		port->read_status_mask |= SR_BE;
 	if (termios->c_iflag & INPCK)
 		port->read_status_mask |= SR_PE | SR_FE;
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
index 5ba30e078236..409d7ad0ac75 100644
--- a/drivers/tty/serial/pmac_zilog.c
+++ b/drivers/tty/serial/pmac_zilog.c
@@ -1090,7 +1090,7 @@ static void pmz_convert_to_zs(struct uart_pmac_port *uap, unsigned int cflag,
 	uap->port.read_status_mask = Rx_OVR;
 	if (iflag & INPCK)
 		uap->port.read_status_mask |= CRC_ERR | PAR_ERR;
-	if (iflag & (BRKINT | PARMRK))
+	if (iflag & (IGNBRK | BRKINT | PARMRK))
 		uap->port.read_status_mask |= BRK_ABRT;
 
 	uap->port.ignore_status_mask = 0;
diff --git a/drivers/tty/serial/pnx8xxx_uart.c b/drivers/tty/serial/pnx8xxx_uart.c
index de6c05c63683..2ba24a45c97f 100644
--- a/drivers/tty/serial/pnx8xxx_uart.c
+++ b/drivers/tty/serial/pnx8xxx_uart.c
@@ -477,7 +477,7 @@ pnx8xxx_set_termios(struct uart_port *port, struct ktermios *termios,
 		sport->port.read_status_mask |=
 			FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE) |
 			FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR);
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		sport->port.read_status_mask |=
 			ISTAT_TO_SM(PNX8XXX_UART_INT_BREAK);
 
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index f9f20f383760..fc3f308cd6c1 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -492,7 +492,7 @@ serial_pxa_set_termios(struct uart_port *port, struct ktermios *termios,
 	up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR;
 	if (termios->c_iflag & INPCK)
 		up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE;
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		up->port.read_status_mask |= UART_LSR_BI;
 
 	/*
diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c
index a7cdec2962dd..771f361c47ea 100644
--- a/drivers/tty/serial/sb1250-duart.c
+++ b/drivers/tty/serial/sb1250-duart.c
@@ -596,7 +596,7 @@ static void sbd_set_termios(struct uart_port *uport, struct ktermios *termios,
 	if (termios->c_iflag & INPCK)
 		uport->read_status_mask |= M_DUART_FRM_ERR |
 					   M_DUART_PARITY_ERR;
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		uport->read_status_mask |= M_DUART_RCVD_BRK;
 
 	uport->ignore_status_mask = 0;
diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c
index 49e9bbfe6cab..0ea128a76b1b 100644
--- a/drivers/tty/serial/sccnxp.c
+++ b/drivers/tty/serial/sccnxp.c
@@ -667,7 +667,7 @@ static void sccnxp_set_termios(struct uart_port *port,
 	port->read_status_mask = SR_OVR;
 	if (termios->c_iflag & INPCK)
 		port->read_status_mask |= SR_PE | SR_FE;
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		port->read_status_mask |= SR_BRK;
 
 	/* Set status ignore mask */
diff --git a/drivers/tty/serial/serial_ks8695.c b/drivers/tty/serial/serial_ks8695.c
index e1caa99e3d3b..5c79bdab985d 100644
--- a/drivers/tty/serial/serial_ks8695.c
+++ b/drivers/tty/serial/serial_ks8695.c
@@ -437,7 +437,7 @@ static void ks8695uart_set_termios(struct uart_port *port, struct ktermios *term
 	port->read_status_mask = URLS_URROE;
 	if (termios->c_iflag & INPCK)
 		port->read_status_mask |= (URLS_URFE | URLS_URPE);
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		port->read_status_mask |= URLS_URBI;
 
 	/*
diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c
index 440a962412da..ce13f42814a3 100644
--- a/drivers/tty/serial/serial_txx9.c
+++ b/drivers/tty/serial/serial_txx9.c
@@ -702,7 +702,7 @@ serial_txx9_set_termios(struct uart_port *port, struct ktermios *termios,
 		TXX9_SIDISR_TDIS | TXX9_SIDISR_RDIS;
 	if (termios->c_iflag & INPCK)
 		up->port.read_status_mask |= TXX9_SIDISR_UFER | TXX9_SIDISR_UPER;
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		up->port.read_status_mask |= TXX9_SIDISR_UBRK;
 
 	/*
diff --git a/drivers/tty/serial/sirfsoc_uart.c b/drivers/tty/serial/sirfsoc_uart.c
index a72c33f8e263..6904818d3424 100644
--- a/drivers/tty/serial/sirfsoc_uart.c
+++ b/drivers/tty/serial/sirfsoc_uart.c
@@ -897,7 +897,7 @@ static void sirfsoc_uart_set_termios(struct uart_port *port,
 		if (termios->c_iflag & INPCK)
 			port->read_status_mask |= uint_en->sirfsoc_frm_err_en;
 	}
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 			port->read_status_mask |= uint_en->sirfsoc_rxd_brk_en;
 	if (sirfport->uart_reg->uart_type == SIRF_REAL_UART) {
 		if (termios->c_iflag & IGNPAR)
diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index 21e6e84c0df8..0ee31755cb5a 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -547,7 +547,7 @@ static void asc_set_termios(struct uart_port *port, struct ktermios *termios,
 	ascport->port.read_status_mask = ASC_RXBUF_DUMMY_OE;
 	if (termios->c_iflag & INPCK)
 		ascport->port.read_status_mask |= ASC_RXBUF_FE | ASC_RXBUF_PE;
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		ascport->port.read_status_mask |= ASC_RXBUF_DUMMY_BE;
 
 	/*
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c
index 5d6136b2a04a..2fee558f2b13 100644
--- a/drivers/tty/serial/sunsab.c
+++ b/drivers/tty/serial/sunsab.c
@@ -719,7 +719,7 @@ static void sunsab_convert_to_sab(struct uart_sunsab_port *up, unsigned int cfla
 	if (iflag & INPCK)
 		up->port.read_status_mask |= (SAB82532_ISR0_PERR |
 					      SAB82532_ISR0_FERR);
-	if (iflag & (BRKINT | PARMRK))
+	if (iflag & (IGNBRK | BRKINT | PARMRK))
 		up->port.read_status_mask |= (SAB82532_ISR1_BRK << 8);
 
 	/*
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c
index 699cc1b5f6aa..c41a5b8b717f 100644
--- a/drivers/tty/serial/sunsu.c
+++ b/drivers/tty/serial/sunsu.c
@@ -834,7 +834,7 @@ sunsu_change_speed(struct uart_port *port, unsigned int cflag,
 	up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR;
 	if (iflag & INPCK)
 		up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE;
-	if (iflag & (BRKINT | PARMRK))
+	if (iflag & (IGNBRK | BRKINT | PARMRK))
 		up->port.read_status_mask |= UART_LSR_BI;
 
 	/*
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c
index 135a15203532..ed92578eba4e 100644
--- a/drivers/tty/serial/sunzilog.c
+++ b/drivers/tty/serial/sunzilog.c
@@ -915,7 +915,7 @@ sunzilog_convert_to_zs(struct uart_sunzilog_port *up, unsigned int cflag,
 	up->port.read_status_mask = Rx_OVR;
 	if (iflag & INPCK)
 		up->port.read_status_mask |= CRC_ERR | PAR_ERR;
-	if (iflag & (BRKINT | PARMRK))
+	if (iflag & (IGNBRK | BRKINT | PARMRK))
 		up->port.read_status_mask |= BRK_ABRT;
 
 	up->port.ignore_status_mask = 0;
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 88317482b81f..37df3897cb5a 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -934,7 +934,7 @@ static void qe_uart_set_termios(struct uart_port *port,
 	port->read_status_mask = BD_SC_EMPTY | BD_SC_OV;
 	if (termios->c_iflag & INPCK)
 		port->read_status_mask |= BD_SC_FR | BD_SC_PR;
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		port->read_status_mask |= BD_SC_BR;
 
 	/*
diff --git a/drivers/tty/serial/vr41xx_siu.c b/drivers/tty/serial/vr41xx_siu.c
index a63c14bc9a24..db0c8a4ab03e 100644
--- a/drivers/tty/serial/vr41xx_siu.c
+++ b/drivers/tty/serial/vr41xx_siu.c
@@ -559,7 +559,7 @@ static void siu_set_termios(struct uart_port *port, struct ktermios *new,
 	port->read_status_mask = UART_LSR_THRE | UART_LSR_OE | UART_LSR_DR;
 	if (c_iflag & INPCK)
 		port->read_status_mask |= UART_LSR_FE | UART_LSR_PE;
-	if (c_iflag & (BRKINT | PARMRK))
+	if (c_iflag & (IGNBRK | BRKINT | PARMRK))
 		port->read_status_mask |= UART_LSR_BI;
 
 	port->ignore_status_mask = 0;
diff --git a/drivers/tty/serial/zs.c b/drivers/tty/serial/zs.c
index 6a169877109b..2b65bb7ffb8a 100644
--- a/drivers/tty/serial/zs.c
+++ b/drivers/tty/serial/zs.c
@@ -923,7 +923,7 @@ static void zs_set_termios(struct uart_port *uport, struct ktermios *termios,
 	uport->read_status_mask = Rx_OVR;
 	if (termios->c_iflag & INPCK)
 		uport->read_status_mask |= FRM_ERR | PAR_ERR;
-	if (termios->c_iflag & (BRKINT | PARMRK))
+	if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK))
 		uport->read_status_mask |= Rx_BRK;
 
 	uport->ignore_status_mask = 0;
-- 
2.0.0


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

* [PATCH 3.12 121/170] tty: Correct INPCK handling
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (119 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 120/170] serial: Fix IGNBRK handling Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 122/170] mmc: rtsx: add R1-no-CRC mmc command type handle Jiri Slaby
                   ` (49 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Peter Hurley, Jiri Slaby

From: Peter Hurley <peter@hurleysoftware.com>

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

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

commit 66528f90669691c85c73bea4f0c9f4a5857c4cab upstream.

If INPCK is not set, input parity detection should be disabled. This means
parity errors should not be received from the tty driver, and the data
received should be treated normally.

SUS v3, 11.2.2, General Terminal Interface - Input Modes, states:
  "If INPCK is set, input parity checking shall be enabled. If INPCK is
   not set, input parity checking shall be disabled, allowing output parity
   generation without input parity errors. Note that whether input parity
   checking is enabled or disabled is independent of whether parity detection
   is enabled or disabled (see Control Modes). If parity detection is enabled
   but input parity checking is disabled, the hardware to which the terminal
   is connected shall recognize the parity bit, but the terminal special file
   shall not check whether or not this bit is correctly set."

Ignore parity errors reported by the tty driver when INPCK is not set, and
handle the received data normally.

Fixes: Bugzilla #71681, 'Improvement of n_tty_receive_parity_error from n_tty.c'
Reported-by: Ivan <athlon_@mail.ru>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/n_tty.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index bd73dc25b41d..eac1b0d5b463 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1210,15 +1210,16 @@ static void n_tty_receive_parity_error(struct tty_struct *tty, unsigned char c)
 {
 	struct n_tty_data *ldata = tty->disc_data;
 
-	if (I_IGNPAR(tty))
-		return;
-	if (I_PARMRK(tty)) {
-		put_tty_queue('\377', ldata);
-		put_tty_queue('\0', ldata);
-		put_tty_queue(c, ldata);
-	} else	if (I_INPCK(tty))
-		put_tty_queue('\0', ldata);
-	else
+	if (I_INPCK(tty)) {
+		if (I_IGNPAR(tty))
+			return;
+		if (I_PARMRK(tty)) {
+			put_tty_queue('\377', ldata);
+			put_tty_queue('\0', ldata);
+			put_tty_queue(c, ldata);
+		} else
+			put_tty_queue('\0', ldata);
+	} else
 		put_tty_queue(c, ldata);
 	wake_up_interruptible(&tty->read_wait);
 }
-- 
2.0.0


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

* [PATCH 3.12 122/170] mmc: rtsx: add R1-no-CRC mmc command type handle
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (120 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 121/170] tty: Correct INPCK handling Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 123/170] ALSA: usb-audio: Suppress repetitive debug messages from retire_playback_urb() Jiri Slaby
                   ` (48 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Micky Ching, Ulf Hansson, Chris Ball, Jiri Slaby

From: Micky Ching <micky_ching@realsil.com.cn>

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

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

commit 5027251eced6e34315a52bd841279df957f627bb upstream.

a27fbf2f067b0cd ("mmc: add ignorance case for CMD13 CRC error") produced
a cmd.flags unhandled in realtek pci host driver.  This will make MMC
card fail to initialize, this patch is used to handle the new cmd.flags
condition and MMC card can be used.

Signed-off-by: Micky Ching <micky_ching@realsil.com.cn>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/mmc/host/rtsx_pci_sdmmc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c
index 375a880e0c5f..54e8ba45c3ad 100644
--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
+++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
@@ -246,6 +246,9 @@ static void sd_send_cmd_get_rsp(struct realtek_pci_sdmmc *host,
 	case MMC_RSP_R1:
 		rsp_type = SD_RSP_TYPE_R1;
 		break;
+	case MMC_RSP_R1 & ~MMC_RSP_CRC:
+		rsp_type = SD_RSP_TYPE_R1 | SD_NO_CHECK_CRC7;
+		break;
 	case MMC_RSP_R1B:
 		rsp_type = SD_RSP_TYPE_R1b;
 		break;
-- 
2.0.0


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

* [PATCH 3.12 123/170] ALSA: usb-audio: Suppress repetitive debug messages from retire_playback_urb()
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (121 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 122/170] mmc: rtsx: add R1-no-CRC mmc command type handle Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 124/170] ALSA: usb-audio: Prevent printk ratelimiting from spamming kernel log while DEBUG not defined Jiri Slaby
                   ` (47 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Tim Gardner, Jaroslav Kysela, Takashi Iwai,
	Eldad Zack, Daniel Mack, Clemens Ladisch, Jiri Slaby

From: Tim Gardner <tim.gardner@canonical.com>

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

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

commit a5065eb6da55b226661456e6a7435f605df98111 upstream.

BugLink: http://bugs.launchpad.net/bugs/1305133

Malfunctioning or slow devices can cause a flood of dmesg SPAM.

I've ignored checkpatch.pl complaints about the use of printk_ratelimit() in favour
of prior art in sound/usb/pcm.c.

WARNING: Prefer printk_ratelimited or pr_<level>_ratelimited to printk_ratelimit
+	if (printk_ratelimit() &&

Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Eldad Zack <eldad@fogrefinery.com>
Cc: Daniel Mack <zonque@gmail.com>
Cc: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/usb/pcm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index b375d58871e7..d59e0c1a3e20 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -1491,7 +1491,8 @@ static void retire_playback_urb(struct snd_usb_substream *subs,
 	 * The error should be lower than 2ms since the estimate relies
 	 * on two reads of a counter updated every ms.
 	 */
-	if (abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2)
+	if (printk_ratelimit() &&
+	    abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2)
 		snd_printk(KERN_DEBUG "delay: estimated %d, actual %d\n",
 			est_delay, subs->last_delay);
 
-- 
2.0.0


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

* [PATCH 3.12 124/170] ALSA: usb-audio: Prevent printk ratelimiting from spamming kernel log while DEBUG not defined
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (122 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 123/170] ALSA: usb-audio: Suppress repetitive debug messages from retire_playback_urb() Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 125/170] sym53c8xx_2: Set DID_REQUEUE return code when aborting squeue Jiri Slaby
                   ` (46 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Sander Eikelenboom, Takashi Iwai, Jiri Slaby

From: Sander Eikelenboom <linux@eikelenboom.it>

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

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

commit b7a7723513dc89f83d6df13206df55d4dc26e825 upstream.

This (widely used) construction:

if(printk_ratelimit())
	dev_dbg()

Causes the ratelimiting to spam the kernel log with the "callbacks suppressed"
message below, even while the dev_dbg it is supposed to rate limit wouldn't
print anything because DEBUG is not defined for this device.

[  533.803964] retire_playback_urb: 852 callbacks suppressed
[  538.807930] retire_playback_urb: 852 callbacks suppressed
[  543.811897] retire_playback_urb: 852 callbacks suppressed
[  548.815745] retire_playback_urb: 852 callbacks suppressed
[  553.819826] retire_playback_urb: 852 callbacks suppressed

So use dev_dbg_ratelimited() instead of this construction.

Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/usb/pcm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index d59e0c1a3e20..98ca3540514f 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -1491,9 +1491,9 @@ static void retire_playback_urb(struct snd_usb_substream *subs,
 	 * The error should be lower than 2ms since the estimate relies
 	 * on two reads of a counter updated every ms.
 	 */
-	if (printk_ratelimit() &&
-	    abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2)
-		snd_printk(KERN_DEBUG "delay: estimated %d, actual %d\n",
+	if (abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2)
+		dev_dbg_ratelimited(&subs->dev->dev,
+			"delay: estimated %d, actual %d\n",
 			est_delay, subs->last_delay);
 
 	if (!subs->running) {
-- 
2.0.0


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

* [PATCH 3.12 125/170] sym53c8xx_2: Set DID_REQUEUE return code when aborting squeue
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (123 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 124/170] ALSA: usb-audio: Prevent printk ratelimiting from spamming kernel log while DEBUG not defined Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 126/170] mm: fix crashes from mbind() merging vmas Jiri Slaby
                   ` (45 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Mikulas Patocka, Matthew Wilcox, James Bottomley,
	Linus Torvalds, Jiri Slaby

From: Mikulas Patocka <mpatocka@redhat.com>

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

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

commit fd1232b214af43a973443aec6a2808f16ee5bf70 upstream.

This patch fixes I/O errors with the sym53c8xx_2 driver when the disk
returns QUEUE FULL status.

When the controller encounters an error (including QUEUE FULL or BUSY
status), it aborts all not yet submitted requests in the function
sym_dequeue_from_squeue.

This function aborts them with DID_SOFT_ERROR.

If the disk has full tag queue, the request that caused the overflow is
aborted with QUEUE FULL status (and the scsi midlayer properly retries
it until it is accepted by the disk), but the sym53c8xx_2 driver aborts
the following requests with DID_SOFT_ERROR --- for them, the midlayer
does just a few retries and then signals the error up to sd.

The result is that disk returning QUEUE FULL causes request failures.

The error was reproduced on 53c895 with COMPAQ BD03685A24 disk
(rebranded ST336607LC) with command queue 48 or 64 tags.  The disk has
64 tags, but under some access patterns it return QUEUE FULL when there
are less than 64 pending tags.  The SCSI specification allows returning
QUEUE FULL anytime and it is up to the host to retry.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/sym53c8xx_2/sym_hipd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index d92fe4037e94..6b349e301869 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -3000,7 +3000,11 @@ sym_dequeue_from_squeue(struct sym_hcb *np, int i, int target, int lun, int task
 		if ((target == -1 || cp->target == target) &&
 		    (lun    == -1 || cp->lun    == lun)    &&
 		    (task   == -1 || cp->tag    == task)) {
+#ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING
 			sym_set_cam_status(cp->cmd, DID_SOFT_ERROR);
+#else
+			sym_set_cam_status(cp->cmd, DID_REQUEUE);
+#endif
 			sym_remque(&cp->link_ccbq);
 			sym_insque_tail(&cp->link_ccbq, &np->comp_ccbq);
 		}
-- 
2.0.0


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

* [PATCH 3.12 126/170] mm: fix crashes from mbind() merging vmas
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (124 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 125/170] sym53c8xx_2: Set DID_REQUEUE return code when aborting squeue Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 127/170] usb: option: Add ID for Telewell TW-LTE 4G v2 Jiri Slaby
                   ` (44 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Hugh Dickins, KOSAKI Motohiro, Minchan Kim,
	Andrew Morton, Linus Torvalds, Jiri Slaby

From: Hugh Dickins <hughd@google.com>

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

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

commit d05f0cdcbe6388723f1900c549b4850360545201 upstream.

In v2.6.34 commit 9d8cebd4bcd7 ("mm: fix mbind vma merge problem")
introduced vma merging to mbind(), but it should have also changed the
convention of passing start vma from queue_pages_range() (formerly
check_range()) to new_vma_page(): vma merging may have already freed
that structure, resulting in BUG at mm/mempolicy.c:1738 and probably
worse crashes.

Fixes: 9d8cebd4bcd7 ("mm: fix mbind vma merge problem")
Reported-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Tested-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Minchan Kim <minchan.kim@gmail.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/mempolicy.c | 46 ++++++++++++++++++++--------------------------
 1 file changed, 20 insertions(+), 26 deletions(-)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index a005cc9f6f18..945316989352 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -653,19 +653,18 @@ static unsigned long change_prot_numa(struct vm_area_struct *vma,
  * @nodes and @flags,) it's isolated and queued to the pagelist which is
  * passed via @private.)
  */
-static struct vm_area_struct *
+static int
 queue_pages_range(struct mm_struct *mm, unsigned long start, unsigned long end,
 		const nodemask_t *nodes, unsigned long flags, void *private)
 {
-	int err;
-	struct vm_area_struct *first, *vma, *prev;
-
+	int err = 0;
+	struct vm_area_struct *vma, *prev;
 
-	first = find_vma(mm, start);
-	if (!first)
-		return ERR_PTR(-EFAULT);
+	vma = find_vma(mm, start);
+	if (!vma)
+		return -EFAULT;
 	prev = NULL;
-	for (vma = first; vma && vma->vm_start < end; vma = vma->vm_next) {
+	for (; vma && vma->vm_start < end; vma = vma->vm_next) {
 		unsigned long endvma = vma->vm_end;
 
 		if (endvma > end)
@@ -675,9 +674,9 @@ queue_pages_range(struct mm_struct *mm, unsigned long start, unsigned long end,
 
 		if (!(flags & MPOL_MF_DISCONTIG_OK)) {
 			if (!vma->vm_next && vma->vm_end < end)
-				return ERR_PTR(-EFAULT);
+				return -EFAULT;
 			if (prev && prev->vm_end < vma->vm_start)
-				return ERR_PTR(-EFAULT);
+				return -EFAULT;
 		}
 
 		if (flags & MPOL_MF_LAZY) {
@@ -691,15 +690,13 @@ queue_pages_range(struct mm_struct *mm, unsigned long start, unsigned long end,
 
 			err = queue_pages_pgd_range(vma, start, endvma, nodes,
 						flags, private);
-			if (err) {
-				first = ERR_PTR(err);
+			if (err)
 				break;
-			}
 		}
 next:
 		prev = vma;
 	}
-	return first;
+	return err;
 }
 
 /*
@@ -1184,16 +1181,17 @@ out:
 
 /*
  * Allocate a new page for page migration based on vma policy.
- * Start assuming that page is mapped by vma pointed to by @private.
+ * Start by assuming the page is mapped by the same vma as contains @start.
  * Search forward from there, if not.  N.B., this assumes that the
  * list of pages handed to migrate_pages()--which is how we get here--
  * is in virtual address order.
  */
-static struct page *new_vma_page(struct page *page, unsigned long private, int **x)
+static struct page *new_page(struct page *page, unsigned long start, int **x)
 {
-	struct vm_area_struct *vma = (struct vm_area_struct *)private;
+	struct vm_area_struct *vma;
 	unsigned long uninitialized_var(address);
 
+	vma = find_vma(current->mm, start);
 	while (vma) {
 		address = page_address_in_vma(page, vma);
 		if (address != -EFAULT)
@@ -1223,7 +1221,7 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from,
 	return -ENOSYS;
 }
 
-static struct page *new_vma_page(struct page *page, unsigned long private, int **x)
+static struct page *new_page(struct page *page, unsigned long start, int **x)
 {
 	return NULL;
 }
@@ -1233,7 +1231,6 @@ static long do_mbind(unsigned long start, unsigned long len,
 		     unsigned short mode, unsigned short mode_flags,
 		     nodemask_t *nmask, unsigned long flags)
 {
-	struct vm_area_struct *vma;
 	struct mm_struct *mm = current->mm;
 	struct mempolicy *new;
 	unsigned long end;
@@ -1299,11 +1296,9 @@ static long do_mbind(unsigned long start, unsigned long len,
 	if (err)
 		goto mpol_out;
 
-	vma = queue_pages_range(mm, start, end, nmask,
+	err = queue_pages_range(mm, start, end, nmask,
 			  flags | MPOL_MF_INVERT, &pagelist);
-
-	err = PTR_ERR(vma);	/* maybe ... */
-	if (!IS_ERR(vma))
+	if (!err)
 		err = mbind_range(mm, start, end, new);
 
 	if (!err) {
@@ -1311,9 +1306,8 @@ static long do_mbind(unsigned long start, unsigned long len,
 
 		if (!list_empty(&pagelist)) {
 			WARN_ON_ONCE(flags & MPOL_MF_LAZY);
-			nr_failed = migrate_pages(&pagelist, new_vma_page,
-					(unsigned long)vma,
-					MIGRATE_SYNC, MR_MEMPOLICY_MBIND);
+			nr_failed = migrate_pages(&pagelist, new_page,
+				start, MIGRATE_SYNC, MR_MEMPOLICY_MBIND);
 			if (nr_failed)
 				putback_movable_pages(&pagelist);
 		}
-- 
2.0.0


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

* [PATCH 3.12 127/170] usb: option: Add ID for Telewell TW-LTE 4G v2
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (125 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 126/170] mm: fix crashes from mbind() merging vmas Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 128/170] USB: cp210x: add support for Corsair usb dongle Jiri Slaby
                   ` (43 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Bernd Wachter, Johan Hovold, Jiri Slaby

From: Bernd Wachter <bernd.wachter@jolla.com>

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

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

commit 3d28bd840b2d3981cd28caf5fe1df38f1344dd60 upstream.

Add ID of the Telewell 4G v2 hardware to option driver to get legacy
serial interface working

Signed-off-by: Bernd Wachter <bernd.wachter@jolla.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/option.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index e25e8ca09fe2..9da566a3f5c8 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -1487,6 +1487,8 @@ static const struct usb_device_id option_ids[] = {
 		.driver_info = (kernel_ulong_t)&net_intf2_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1426, 0xff, 0xff, 0xff),  /* ZTE MF91 */
 		.driver_info = (kernel_ulong_t)&net_intf2_blacklist },
+	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1428, 0xff, 0xff, 0xff),  /* Telewell TW-LTE 4G v2 */
+		.driver_info = (kernel_ulong_t)&net_intf2_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1533, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1534, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1535, 0xff, 0xff, 0xff) },
-- 
2.0.0


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

* [PATCH 3.12 128/170] USB: cp210x: add support for Corsair usb dongle
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (126 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 127/170] usb: option: Add ID for Telewell TW-LTE 4G v2 Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 129/170] USB: ftdi_sio: Add extra PID Jiri Slaby
                   ` (42 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Andras Kovacs, Johan Hovold, Jiri Slaby

From: Andras Kovacs <andras@sth.sze.hu>

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

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

commit b9326057a3d8447f5d2e74a7b521ccf21add2ec0 upstream.

Corsair USB Dongles are shipped with Corsair AXi series PSUs.
These are cp210x serial usb devices, so make driver detect these.
I have a program, that can get information from these PSUs.

Tested with 2 different dongles shipped with Corsair AX860i and
AX1200i units.

Signed-off-by: Andras Kovacs <andras@sth.sze.hu>
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 71873cafb9d3..1db213a6e843 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -153,6 +153,7 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
 	{ USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
 	{ USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */
+	{ USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */
 	{ USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */
 	{ USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */
 	{ USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */
-- 
2.0.0


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

* [PATCH 3.12 129/170] USB: ftdi_sio: Add extra PID.
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (127 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 128/170] USB: cp210x: add support for Corsair usb dongle Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 130/170] USB: serial: ftdi_sio: Add Infineon Triboard Jiri Slaby
                   ` (41 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Bert Vermeulen, Johan Hovold, Jiri Slaby

From: Bert Vermeulen <bert@biot.com>

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

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

commit 5a7fbe7e9ea0b1b9d7ffdba64db1faa3a259164c upstream.

This patch adds PID 0x0003 to the VID 0x128d (Testo). At least the
Testo 435-4 uses this, likely other gear as well.

Signed-off-by: Bert Vermeulen <bert@biot.com>
Cc: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/ftdi_sio.c     | 3 ++-
 drivers/usb/serial/ftdi_sio_ids.h | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index ebf04c7d49cb..399fe9fa4db0 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -721,7 +721,8 @@ static struct usb_device_id id_table_combined [] = {
 	{ USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) },
-	{ USB_DEVICE(TESTO_VID, TESTO_USB_INTERFACE_PID) },
+	{ USB_DEVICE(TESTO_VID, TESTO_1_PID) },
+	{ USB_DEVICE(TESTO_VID, TESTO_3_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_GAMMA_SCOUT_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13M_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13S_PID) },
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 500474c48f4b..106cc16cc6ed 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -798,7 +798,8 @@
  * Submitted by Colin Leroy
  */
 #define TESTO_VID			0x128D
-#define TESTO_USB_INTERFACE_PID		0x0001
+#define TESTO_1_PID			0x0001
+#define TESTO_3_PID			0x0003
 
 /*
  * Mobility Electronics products.
-- 
2.0.0


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

* [PATCH 3.12 130/170] USB: serial: ftdi_sio: Add Infineon Triboard
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (128 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 129/170] USB: ftdi_sio: Add extra PID Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 131/170] iio: ti_am335x_adc: Fix: Use same step id at FIFOs both ends Jiri Slaby
                   ` (40 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Michal Sojka, Johan Hovold, Jiri Slaby

From: Michal Sojka <sojkam1@fel.cvut.cz>

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

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

commit d8279a40e50ad55539780aa617a32a53d7f0953e upstream.

This adds support for Infineon TriBoard TC1798 [1]. Only interface 1
is used as serial line (see [2], Figure 8-6).

[1] http://www.infineon.com/cms/de/product/microcontroller/development-tools-software-and-kits/tricore-tm-development-tools-software-and-kits/starterkits-and-evaluation-boards/starter-kit-tc1798/channel.html?channel=db3a304333b8a7ca0133cfa3d73e4268
[2] http://www.infineon.com/dgdl/TriBoardManual-TC1798-V10.pdf?folderId=db3a304412b407950112b409ae7c0343&fileId=db3a304333b8a7ca0133cfae99fe426a

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
Cc: 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 | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 399fe9fa4db0..e0bf8ee1f976 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -946,6 +946,8 @@ static struct usb_device_id id_table_combined [] = {
 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) },
 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) },
 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) },
+	/* Infineon Devices */
+	{ USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) },
 	{ }					/* Terminating entry */
 };
 
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 106cc16cc6ed..c4777bc6aee0 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -584,6 +584,12 @@
 #define RATOC_PRODUCT_ID_USB60F	0xb020
 
 /*
+ * Infineon Technologies
+ */
+#define INFINEON_VID		0x058b
+#define INFINEON_TRIBOARD_PID	0x0028 /* DAS JTAG TriBoard TC1798 V1.0 */
+
+/*
  * Acton Research Corp.
  */
 #define ACTON_VID		0x0647	/* Vendor ID */
-- 
2.0.0


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

* [PATCH 3.12 131/170] iio: ti_am335x_adc: Fix: Use same step id at FIFOs both ends
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (129 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 130/170] USB: serial: ftdi_sio: Add Infineon Triboard Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 132/170] workqueue: fix dev_set_uevent_suppress() imbalance Jiri Slaby
                   ` (39 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jan Kardell, Jonathan Cameron, Jiri Slaby

From: Jan Kardell <jan.kardell@telliq.com>

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

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

commit baa3c65298c089a9014b4e523a14ec2885cca1bc upstream.

Since AI lines could be selected at will (linux-3.11) the sending
and receiving ends of the FIFO does not agree about what step is used
for a line. It only works if the last lines are used, like 5,6,7,
and fails if ie 2,4,6 is selected in DT.

Signed-off-by: Jan Kardell <jan.kardell@telliq.com>
Tested-by: Zubair Lutfullah <zubair.lutfullah@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/iio/adc/ti_am335x_adc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index a952538a1a8b..b9ed661293a7 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -155,7 +155,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
 		if (time_after(jiffies, timeout))
 			return -EAGAIN;
 		}
-	map_val = chan->channel + TOTAL_CHANNELS;
+	map_val = adc_dev->channel_step[chan->scan_index];
 
 	/*
 	 * When the sub-system is first enabled,
-- 
2.0.0


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

* [PATCH 3.12 132/170] workqueue: fix dev_set_uevent_suppress() imbalance
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (130 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 131/170] iio: ti_am335x_adc: Fix: Use same step id at FIFOs both ends Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 133/170] cpuset,mempolicy: fix sleeping function called from invalid context Jiri Slaby
                   ` (38 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Maxime Bizon, Tejun Heo, Jiri Slaby

From: Maxime Bizon <mbizon@freebox.fr>

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

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

commit bddbceb688c6d0decaabc7884fede319d02f96c8 upstream.

Uevents are suppressed during attributes registration, but never
restored, so kobject_uevent() does nothing.

Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: 226223ab3c4118ddd10688cc2c131135848371ab
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/workqueue.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index cea58300f650..e0b695893579 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3412,6 +3412,7 @@ int workqueue_sysfs_register(struct workqueue_struct *wq)
 		}
 	}
 
+	dev_set_uevent_suppress(&wq_dev->dev, false);
 	kobject_uevent(&wq_dev->dev.kobj, KOBJ_ADD);
 	return 0;
 }
-- 
2.0.0


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

* [PATCH 3.12 133/170] cpuset,mempolicy: fix sleeping function called from invalid context
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (131 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 132/170] workqueue: fix dev_set_uevent_suppress() imbalance Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 134/170] workqueue: zero cpumask of wq_numa_possible_cpumask on init Jiri Slaby
                   ` (37 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Gu Zheng, Tejun Heo, Jiri Slaby

From: Gu Zheng <guz.fnst@cn.fujitsu.com>

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

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

commit 391acf970d21219a2a5446282d3b20eace0c0d7a upstream.

When runing with the kernel(3.15-rc7+), the follow bug occurs:
[ 9969.258987] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:586
[ 9969.359906] in_atomic(): 1, irqs_disabled(): 0, pid: 160655, name: python
[ 9969.441175] INFO: lockdep is turned off.
[ 9969.488184] CPU: 26 PID: 160655 Comm: python Tainted: G       A      3.15.0-rc7+ #85
[ 9969.581032] Hardware name: FUJITSU-SV PRIMEQUEST 1800E/SB, BIOS PRIMEQUEST 1000 Series BIOS Version 1.39 11/16/2012
[ 9969.706052]  ffffffff81a20e60 ffff8803e941fbd0 ffffffff8162f523 ffff8803e941fd18
[ 9969.795323]  ffff8803e941fbe0 ffffffff8109995a ffff8803e941fc58 ffffffff81633e6c
[ 9969.884710]  ffffffff811ba5dc ffff880405c6b480 ffff88041fdd90a0 0000000000002000
[ 9969.974071] Call Trace:
[ 9970.003403]  [<ffffffff8162f523>] dump_stack+0x4d/0x66
[ 9970.065074]  [<ffffffff8109995a>] __might_sleep+0xfa/0x130
[ 9970.130743]  [<ffffffff81633e6c>] mutex_lock_nested+0x3c/0x4f0
[ 9970.200638]  [<ffffffff811ba5dc>] ? kmem_cache_alloc+0x1bc/0x210
[ 9970.272610]  [<ffffffff81105807>] cpuset_mems_allowed+0x27/0x140
[ 9970.344584]  [<ffffffff811b1303>] ? __mpol_dup+0x63/0x150
[ 9970.409282]  [<ffffffff811b1385>] __mpol_dup+0xe5/0x150
[ 9970.471897]  [<ffffffff811b1303>] ? __mpol_dup+0x63/0x150
[ 9970.536585]  [<ffffffff81068c86>] ? copy_process.part.23+0x606/0x1d40
[ 9970.613763]  [<ffffffff810bf28d>] ? trace_hardirqs_on+0xd/0x10
[ 9970.683660]  [<ffffffff810ddddf>] ? monotonic_to_bootbased+0x2f/0x50
[ 9970.759795]  [<ffffffff81068cf0>] copy_process.part.23+0x670/0x1d40
[ 9970.834885]  [<ffffffff8106a598>] do_fork+0xd8/0x380
[ 9970.894375]  [<ffffffff81110e4c>] ? __audit_syscall_entry+0x9c/0xf0
[ 9970.969470]  [<ffffffff8106a8c6>] SyS_clone+0x16/0x20
[ 9971.030011]  [<ffffffff81642009>] stub_clone+0x69/0x90
[ 9971.091573]  [<ffffffff81641c29>] ? system_call_fastpath+0x16/0x1b

The cause is that cpuset_mems_allowed() try to take
mutex_lock(&callback_mutex) under the rcu_read_lock(which was hold in
__mpol_dup()). And in cpuset_mems_allowed(), the access to cpuset is
under rcu_read_lock, so in __mpol_dup, we can reduce the rcu_read_lock
protection region to protect the access to cpuset only in
current_cpuset_is_being_rebound(). So that we can avoid this bug.

This patch is a temporary solution that just addresses the bug
mentioned above, can not fix the long-standing issue about cpuset.mems
rebinding on fork():

"When the forker's task_struct is duplicated (which includes
 ->mems_allowed) and it races with an update to cpuset_being_rebound
 in update_tasks_nodemask() then the task's mems_allowed doesn't get
 updated. And the child task's mems_allowed can be wrong if the
 cpuset's nodemask changes before the child has been added to the
 cgroup's tasklist."

Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Acked-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/cpuset.c | 8 +++++++-
 mm/mempolicy.c  | 2 --
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 5ae9f950e024..0b29c52479a6 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1236,7 +1236,13 @@ done:
 
 int current_cpuset_is_being_rebound(void)
 {
-	return task_cs(current) == cpuset_being_rebound;
+	int ret;
+
+	rcu_read_lock();
+	ret = task_cs(current) == cpuset_being_rebound;
+	rcu_read_unlock();
+
+	return ret;
 }
 
 static int update_relax_domain_level(struct cpuset *cs, s64 val)
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 945316989352..0437f3595b32 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2146,7 +2146,6 @@ struct mempolicy *__mpol_dup(struct mempolicy *old)
 	} else
 		*new = *old;
 
-	rcu_read_lock();
 	if (current_cpuset_is_being_rebound()) {
 		nodemask_t mems = cpuset_mems_allowed(current);
 		if (new->flags & MPOL_F_REBINDING)
@@ -2154,7 +2153,6 @@ struct mempolicy *__mpol_dup(struct mempolicy *old)
 		else
 			mpol_rebind_policy(new, &mems, MPOL_REBIND_ONCE);
 	}
-	rcu_read_unlock();
 	atomic_set(&new->refcnt, 1);
 	return new;
 }
-- 
2.0.0


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

* [PATCH 3.12 134/170] workqueue: zero cpumask of wq_numa_possible_cpumask on init
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (132 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 133/170] cpuset,mempolicy: fix sleeping function called from invalid context Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 135/170] thermal: hwmon: Make the check for critical temp valid consistent Jiri Slaby
                   ` (36 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Yasuaki Ishimatsu, Tejun Heo, Jiri Slaby

From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>

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

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

commit 5a6024f1604eef119cf3a6fa413fe0261a81a8f3 upstream.

When hot-adding and onlining CPU, kernel panic occurs, showing following
call trace.

  BUG: unable to handle kernel paging request at 0000000000001d08
  IP: [<ffffffff8114acfd>] __alloc_pages_nodemask+0x9d/0xb10
  PGD 0
  Oops: 0000 [#1] SMP
  ...
  Call Trace:
   [<ffffffff812b8745>] ? cpumask_next_and+0x35/0x50
   [<ffffffff810a3283>] ? find_busiest_group+0x113/0x8f0
   [<ffffffff81193bc9>] ? deactivate_slab+0x349/0x3c0
   [<ffffffff811926f1>] new_slab+0x91/0x300
   [<ffffffff815de95a>] __slab_alloc+0x2bb/0x482
   [<ffffffff8105bc1c>] ? copy_process.part.25+0xfc/0x14c0
   [<ffffffff810a3c78>] ? load_balance+0x218/0x890
   [<ffffffff8101a679>] ? sched_clock+0x9/0x10
   [<ffffffff81105ba9>] ? trace_clock_local+0x9/0x10
   [<ffffffff81193d1c>] kmem_cache_alloc_node+0x8c/0x200
   [<ffffffff8105bc1c>] copy_process.part.25+0xfc/0x14c0
   [<ffffffff81114d0d>] ? trace_buffer_unlock_commit+0x4d/0x60
   [<ffffffff81085a80>] ? kthread_create_on_node+0x140/0x140
   [<ffffffff8105d0ec>] do_fork+0xbc/0x360
   [<ffffffff8105d3b6>] kernel_thread+0x26/0x30
   [<ffffffff81086652>] kthreadd+0x2c2/0x300
   [<ffffffff81086390>] ? kthread_create_on_cpu+0x60/0x60
   [<ffffffff815f20ec>] ret_from_fork+0x7c/0xb0
   [<ffffffff81086390>] ? kthread_create_on_cpu+0x60/0x60

In my investigation, I found the root cause is wq_numa_possible_cpumask.
All entries of wq_numa_possible_cpumask is allocated by
alloc_cpumask_var_node(). And these entries are used without initializing.
So these entries have wrong value.

When hot-adding and onlining CPU, wq_update_unbound_numa() is called.
wq_update_unbound_numa() calls alloc_unbound_pwq(). And alloc_unbound_pwq()
calls get_unbound_pool(). In get_unbound_pool(), worker_pool->node is set
as follow:

3592         /* if cpumask is contained inside a NUMA node, we belong to that node */
3593         if (wq_numa_enabled) {
3594                 for_each_node(node) {
3595                         if (cpumask_subset(pool->attrs->cpumask,
3596                                            wq_numa_possible_cpumask[node])) {
3597                                 pool->node = node;
3598                                 break;
3599                         }
3600                 }
3601         }

But wq_numa_possible_cpumask[node] does not have correct cpumask. So, wrong
node is selected. As a result, kernel panic occurs.

By this patch, all entries of wq_numa_possible_cpumask are allocated by
zalloc_cpumask_var_node to initialize them. And the panic disappeared.

Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: bce903809ab3 ("workqueue: add wq_numa_tbl_len and wq_numa_possible_cpumask[]")
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/workqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index e0b695893579..3fafbbb31927 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5029,7 +5029,7 @@ static void __init wq_numa_init(void)
 	BUG_ON(!tbl);
 
 	for_each_node(node)
-		BUG_ON(!alloc_cpumask_var_node(&tbl[node], GFP_KERNEL,
+		BUG_ON(!zalloc_cpumask_var_node(&tbl[node], GFP_KERNEL,
 				node_online(node) ? node : NUMA_NO_NODE));
 
 	for_each_possible_cpu(cpu) {
-- 
2.0.0


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

* [PATCH 3.12 135/170] thermal: hwmon: Make the check for critical temp valid consistent
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (133 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 134/170] workqueue: zero cpumask of wq_numa_possible_cpumask on init Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 136/170] hwmon: (amc6821) Fix permissions for temp2_input Jiri Slaby
                   ` (35 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Aaron Lu, Zhang Rui, Jiri Slaby

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

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

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

commit e8db5d6736a712a3e2280c0e31f4b301d85172d8 upstream.

On 05/21/2014 04:22 PM, Aaron Lu wrote:
> On 05/21/2014 01:57 PM, Kui Zhang wrote:
>> Hello,
>>
>> I get following error when rmmod thermal.
>>
>> rmmod  thermal
>> Killed

While dealing with this problem, I found another problem that also
results in a kernel crash on thermal module removal:

From: Aaron Lu <aaron.lu@intel.com>
Date: Wed, 21 May 2014 16:05:38 +0800
Subject: thermal: hwmon: Make the check for critical temp valid consistent

We used the tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, temp)
to decide if we need to create the temp_crit attribute file but we just
check if tz->ops->get_crit_temp exists to decide if we need to remove
that attribute file. Some ACPI thermal zone doesn't have a valid critical
trip point and that would result in removing a non-existent device file
on thermal module unload.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/thermal/thermal_hwmon.c | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
index fdb07199d9c2..1967bee4f076 100644
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -140,6 +140,12 @@ thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon,
 	return NULL;
 }
 
+static bool thermal_zone_crit_temp_valid(struct thermal_zone_device *tz)
+{
+	unsigned long temp;
+	return tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, &temp);
+}
+
 int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
 {
 	struct thermal_hwmon_device *hwmon;
@@ -189,21 +195,18 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
 	if (result)
 		goto free_temp_mem;
 
-	if (tz->ops->get_crit_temp) {
-		unsigned long temperature;
-		if (!tz->ops->get_crit_temp(tz, &temperature)) {
-			snprintf(temp->temp_crit.name,
-				 sizeof(temp->temp_crit.name),
+	if (thermal_zone_crit_temp_valid(tz)) {
+		snprintf(temp->temp_crit.name,
+				sizeof(temp->temp_crit.name),
 				"temp%d_crit", hwmon->count);
-			temp->temp_crit.attr.attr.name = temp->temp_crit.name;
-			temp->temp_crit.attr.attr.mode = 0444;
-			temp->temp_crit.attr.show = temp_crit_show;
-			sysfs_attr_init(&temp->temp_crit.attr.attr);
-			result = device_create_file(hwmon->device,
-						    &temp->temp_crit.attr);
-			if (result)
-				goto unregister_input;
-		}
+		temp->temp_crit.attr.attr.name = temp->temp_crit.name;
+		temp->temp_crit.attr.attr.mode = 0444;
+		temp->temp_crit.attr.show = temp_crit_show;
+		sysfs_attr_init(&temp->temp_crit.attr.attr);
+		result = device_create_file(hwmon->device,
+					    &temp->temp_crit.attr);
+		if (result)
+			goto unregister_input;
 	}
 
 	mutex_lock(&thermal_hwmon_list_lock);
@@ -250,7 +253,7 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
 	}
 
 	device_remove_file(hwmon->device, &temp->temp_input.attr);
-	if (tz->ops->get_crit_temp)
+	if (thermal_zone_crit_temp_valid(tz))
 		device_remove_file(hwmon->device, &temp->temp_crit.attr);
 
 	mutex_lock(&thermal_hwmon_list_lock);
-- 
2.0.0


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

* [PATCH 3.12 136/170] hwmon: (amc6821) Fix permissions for temp2_input
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (134 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 135/170] thermal: hwmon: Make the check for critical temp valid consistent Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 137/170] hwmon: (emc2103) Clamp limits instead of bailing out Jiri Slaby
                   ` (34 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Axel Lin, Guenter Roeck, Jiri Slaby

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

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

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

commit df86754b746e9a0ff6f863f690b1c01d408e3cdc upstream.

temp2_input should not be writable, fix it.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hwmon/amc6821.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c
index eea817296513..9f2be3dd28f3 100644
--- a/drivers/hwmon/amc6821.c
+++ b/drivers/hwmon/amc6821.c
@@ -704,7 +704,7 @@ static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO,
 	get_temp_alarm, NULL, IDX_TEMP1_MAX);
 static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO,
 	get_temp_alarm, NULL, IDX_TEMP1_CRIT);
-static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO | S_IWUSR,
+static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO,
 	get_temp, NULL, IDX_TEMP2_INPUT);
 static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO | S_IWUSR, get_temp,
 	set_temp, IDX_TEMP2_MIN);
-- 
2.0.0


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

* [PATCH 3.12 137/170] hwmon: (emc2103) Clamp limits instead of bailing out
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (135 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 136/170] hwmon: (amc6821) Fix permissions for temp2_input Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 138/170] hwmon: (adm1031) Fix writes to limit registers Jiri Slaby
                   ` (33 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Guenter Roeck, Jiri Slaby

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

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

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

commit f6c2dd20108c35e30e2c1f3c6142d189451a626b upstream.

It is customary to clamp limits instead of bailing out with an error
if a configured limit is out of the range supported by the driver.
This simplifies limit configuration, since the user will not typically
know chip and/or driver specific limits.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hwmon/emc2103.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c
index 2c137b26acb4..5790246a7e1d 100644
--- a/drivers/hwmon/emc2103.c
+++ b/drivers/hwmon/emc2103.c
@@ -250,9 +250,7 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *da,
 	if (result < 0)
 		return result;
 
-	val = DIV_ROUND_CLOSEST(val, 1000);
-	if ((val < -63) || (val > 127))
-		return -EINVAL;
+	val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), -63, 127);
 
 	mutex_lock(&data->update_lock);
 	data->temp_min[nr] = val;
@@ -274,9 +272,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *da,
 	if (result < 0)
 		return result;
 
-	val = DIV_ROUND_CLOSEST(val, 1000);
-	if ((val < -63) || (val > 127))
-		return -EINVAL;
+	val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), -63, 127);
 
 	mutex_lock(&data->update_lock);
 	data->temp_max[nr] = val;
@@ -390,15 +386,14 @@ static ssize_t set_fan_target(struct device *dev, struct device_attribute *da,
 {
 	struct emc2103_data *data = emc2103_update_device(dev);
 	struct i2c_client *client = to_i2c_client(dev);
-	long rpm_target;
+	unsigned long rpm_target;
 
-	int result = kstrtol(buf, 10, &rpm_target);
+	int result = kstrtoul(buf, 10, &rpm_target);
 	if (result < 0)
 		return result;
 
 	/* Datasheet states 16384 as maximum RPM target (table 3.2) */
-	if ((rpm_target < 0) || (rpm_target > 16384))
-		return -EINVAL;
+	rpm_target = clamp_val(rpm_target, 0, 16384);
 
 	mutex_lock(&data->update_lock);
 
-- 
2.0.0


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

* [PATCH 3.12 138/170] hwmon: (adm1031) Fix writes to limit registers
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (136 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 137/170] hwmon: (emc2103) Clamp limits instead of bailing out Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 139/170] hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div Jiri Slaby
                   ` (32 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Guenter Roeck, Axel Lin, Jiri Slaby

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

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

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

commit 145e74a4e5022225adb84f4e5d4fff7938475c35 upstream.

Upper limit for write operations to temperature limit registers
was clamped to a fractional value. However, limit registers do
not support fractional values. As a result, upper limits of 127.5
degrees C or higher resulted in a rounded limit of 128 degrees C.
Since limit registers are signed, this was stored as -128 degrees C.
Clamp limits to (-55, +127) degrees C to solve the problem.

Value on writes to auto_temp[12]_min and auto_temp[12]_max were not
clamped at all, but masked. As a result, out-of-range writes resulted
in a more or less arbitrary limit. Clamp those attributes to (0, 127)
degrees C for more predictable results.

Cc: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hwmon/adm1031.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c
index 253ea396106d..bdceca0d7e22 100644
--- a/drivers/hwmon/adm1031.c
+++ b/drivers/hwmon/adm1031.c
@@ -365,6 +365,7 @@ set_auto_temp_min(struct device *dev, struct device_attribute *attr,
 	if (ret)
 		return ret;
 
+	val = clamp_val(val, 0, 127000);
 	mutex_lock(&data->update_lock);
 	data->auto_temp[nr] = AUTO_TEMP_MIN_TO_REG(val, data->auto_temp[nr]);
 	adm1031_write_value(client, ADM1031_REG_AUTO_TEMP(nr),
@@ -394,6 +395,7 @@ set_auto_temp_max(struct device *dev, struct device_attribute *attr,
 	if (ret)
 		return ret;
 
+	val = clamp_val(val, 0, 127000);
 	mutex_lock(&data->update_lock);
 	data->temp_max[nr] = AUTO_TEMP_MAX_TO_REG(val, data->auto_temp[nr],
 						  data->pwm[nr]);
@@ -696,7 +698,7 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr,
 	if (ret)
 		return ret;
 
-	val = clamp_val(val, -55000, nr == 0 ? 127750 : 127875);
+	val = clamp_val(val, -55000, 127000);
 	mutex_lock(&data->update_lock);
 	data->temp_min[nr] = TEMP_TO_REG(val);
 	adm1031_write_value(client, ADM1031_REG_TEMP_MIN(nr),
@@ -717,7 +719,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,
 	if (ret)
 		return ret;
 
-	val = clamp_val(val, -55000, nr == 0 ? 127750 : 127875);
+	val = clamp_val(val, -55000, 127000);
 	mutex_lock(&data->update_lock);
 	data->temp_max[nr] = TEMP_TO_REG(val);
 	adm1031_write_value(client, ADM1031_REG_TEMP_MAX(nr),
@@ -738,7 +740,7 @@ static ssize_t set_temp_crit(struct device *dev, struct device_attribute *attr,
 	if (ret)
 		return ret;
 
-	val = clamp_val(val, -55000, nr == 0 ? 127750 : 127875);
+	val = clamp_val(val, -55000, 127000);
 	mutex_lock(&data->update_lock);
 	data->temp_crit[nr] = TEMP_TO_REG(val);
 	adm1031_write_value(client, ADM1031_REG_TEMP_CRIT(nr),
-- 
2.0.0


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

* [PATCH 3.12 139/170] hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (137 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 138/170] hwmon: (adm1031) Fix writes to limit registers Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 140/170] hwmon: (adm1021) Fix cache problem when writing temperature limits Jiri Slaby
                   ` (31 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Axel Lin, Guenter Roeck, Jiri Slaby

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

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

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

commit 1035a9e3e9c76b64a860a774f5b867d28d34acc2 upstream.

Writing to fanX_div does not clear the cache. As a result, reading
from fanX_div may return the old value for up to two seconds
after writing a new value.

This patch ensures the fan_div cache is updated in set_fan_div().

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hwmon/adm1029.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c
index 9ee5e066423b..39441e5d922c 100644
--- a/drivers/hwmon/adm1029.c
+++ b/drivers/hwmon/adm1029.c
@@ -232,6 +232,9 @@ static ssize_t set_fan_div(struct device *dev,
 	/* Update the value */
 	reg = (reg & 0x3F) | (val << 6);
 
+	/* Update the cache */
+	data->fan_div[attr->index] = reg;
+
 	/* Write value */
 	i2c_smbus_write_byte_data(client,
 				  ADM1029_REG_FAN_DIV[attr->index], reg);
-- 
2.0.0


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

* [PATCH 3.12 140/170] hwmon: (adm1021) Fix cache problem when writing temperature limits
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (138 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 139/170] hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 141/170] ACPI / EC: Avoid race condition related to advance_transaction() Jiri Slaby
                   ` (30 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Axel Lin, Guenter Roeck, Jiri Slaby

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

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

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

commit c024044d4da2c9c3b32933b4235df1e409293b84 upstream.

The module test script for the adm1021 driver exposes a cache problem
when writing temperature limits. temp_min and temp_max are expected
to be stored in milli-degrees C but are stored in degrees C.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hwmon/adm1021.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c
index 29dd9f746dfa..233b374334ed 100644
--- a/drivers/hwmon/adm1021.c
+++ b/drivers/hwmon/adm1021.c
@@ -185,7 +185,7 @@ static ssize_t set_temp_max(struct device *dev,
 	struct i2c_client *client = to_i2c_client(dev);
 	struct adm1021_data *data = i2c_get_clientdata(client);
 	long temp;
-	int err;
+	int reg_val, err;
 
 	err = kstrtol(buf, 10, &temp);
 	if (err)
@@ -193,10 +193,11 @@ static ssize_t set_temp_max(struct device *dev,
 	temp /= 1000;
 
 	mutex_lock(&data->update_lock);
-	data->temp_max[index] = clamp_val(temp, -128, 127);
+	reg_val = clamp_val(temp, -128, 127);
+	data->temp_max[index] = reg_val * 1000;
 	if (!read_only)
 		i2c_smbus_write_byte_data(client, ADM1021_REG_TOS_W(index),
-					  data->temp_max[index]);
+					  reg_val);
 	mutex_unlock(&data->update_lock);
 
 	return count;
@@ -210,7 +211,7 @@ static ssize_t set_temp_min(struct device *dev,
 	struct i2c_client *client = to_i2c_client(dev);
 	struct adm1021_data *data = i2c_get_clientdata(client);
 	long temp;
-	int err;
+	int reg_val, err;
 
 	err = kstrtol(buf, 10, &temp);
 	if (err)
@@ -218,10 +219,11 @@ static ssize_t set_temp_min(struct device *dev,
 	temp /= 1000;
 
 	mutex_lock(&data->update_lock);
-	data->temp_min[index] = clamp_val(temp, -128, 127);
+	reg_val = clamp_val(temp, -128, 127);
+	data->temp_min[index] = reg_val * 1000;
 	if (!read_only)
 		i2c_smbus_write_byte_data(client, ADM1021_REG_THYST_W(index),
-					  data->temp_min[index]);
+					  reg_val);
 	mutex_unlock(&data->update_lock);
 
 	return count;
-- 
2.0.0


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

* [PATCH 3.12 141/170] ACPI / EC: Avoid race condition related to advance_transaction()
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (139 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 140/170] hwmon: (adm1021) Fix cache problem when writing temperature limits Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 142/170] ACPI / EC: Add asynchronous command byte write support Jiri Slaby
                   ` (29 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Lv Zheng, Rafael J. Wysocki, Jiri Slaby

From: Lv Zheng <lv.zheng@intel.com>

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

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

commit 66b42b78bc1e816f92b662e8888c89195e4199e1 upstream.

The advance_transaction() will be invoked from the IRQ context GPE handler
and the task context ec_poll(). The handling of this function is locked so
that the EC state machine are ensured to be advanced sequentially.

But there is a problem. Before invoking advance_transaction(), EC_SC(R) is
read. Then for advance_transaction(), there could be race condition around
the lock from both contexts. The first one reading the register could fail
this race and when it passes the stale register value to the state machine
advancement code, the hardware condition is totally different from when
the register is read. And the hardware accesses determined from the wrong
hardware status can break the EC state machine. And there could be cases
that the functionalities of the platform firmware are seriously affected.
For example:
 1. When 2 EC_DATA(W) writes compete the IBF=0, the 2nd EC_DATA(W) write may
    be invalid due to IBF=1 after the 1st EC_DATA(W) write. Then the
    hardware will either refuse to respond a next EC_SC(W) write of the next
    command or discard the current WR_EC command when it receives a EC_SC(W)
    write of the next command.
 2. When 1 EC_SC(W) write and 1 EC_DATA(W) write compete the IBF=0, the
    EC_DATA(W) write may be invalid due to IBF=1 after the EC_SC(W) write.
    The next EC_DATA(R) could never be responded by the hardware. This is
    the root cause of the reported issue.

Fix this issue by moving the EC_SC(R) access into the lock so that we can
ensure that the state machine is advanced consistently.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=70891
Link: https://bugzilla.kernel.org/show_bug.cgi?id=63931
Link: https://bugzilla.kernel.org/show_bug.cgi?id=59911
Reported-and-tested-by: Gareth Williams <gareth@garethwilliams.me.uk>
Reported-and-tested-by: Hans de Goede <jwrdegoede@fedoraproject.org>
Reported-by: Barton Xu <tank.xuhan@gmail.com>
Tested-by: Steffen Weber <steffen.weber@gmail.com>
Tested-by: Arthur Chen <axchen@nvidia.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/acpi/ec.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 51b700838f64..f8757316d309 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -175,12 +175,15 @@ static void start_transaction(struct acpi_ec *ec)
 	acpi_ec_write_cmd(ec, ec->curr->command);
 }
 
-static void advance_transaction(struct acpi_ec *ec, u8 status)
+static void advance_transaction(struct acpi_ec *ec)
 {
 	unsigned long flags;
 	struct transaction *t;
+	u8 status;
 
 	spin_lock_irqsave(&ec->lock, flags);
+	pr_debug("===== %s =====\n", in_interrupt() ? "IRQ" : "TASK");
+	status = acpi_ec_read_status(ec);
 	t = ec->curr;
 	if (!t)
 		goto unlock;
@@ -243,7 +246,7 @@ static int ec_poll(struct acpi_ec *ec)
 						msecs_to_jiffies(1)))
 					return 0;
 			}
-			advance_transaction(ec, acpi_ec_read_status(ec));
+			advance_transaction(ec);
 		} while (time_before(jiffies, delay));
 		pr_debug(PREFIX "controller reset, restart transaction\n");
 		spin_lock_irqsave(&ec->lock, flags);
@@ -662,11 +665,8 @@ static u32 acpi_ec_gpe_handler(acpi_handle gpe_device,
 	u32 gpe_number, void *data)
 {
 	struct acpi_ec *ec = data;
-	u8 status = acpi_ec_read_status(ec);
-
-	pr_debug(PREFIX "~~~> interrupt, status:0x%02x\n", status);
 
-	advance_transaction(ec, status);
+	advance_transaction(ec);
 	if (ec_transaction_done(ec) &&
 	    (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) {
 		wake_up(&ec->wait);
-- 
2.0.0


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

* [PATCH 3.12 142/170] ACPI / EC: Add asynchronous command byte write support
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (140 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 141/170] ACPI / EC: Avoid race condition related to advance_transaction() Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 143/170] ACPI / EC: Remove duplicated ec_wait_ibf0() waiter Jiri Slaby
                   ` (28 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Lv Zheng, Rafael J. Wysocki, Jiri Slaby

From: Lv Zheng <lv.zheng@intel.com>

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

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

commit f92fca0060fc4dc9227342d0072d75df98c1e5a5 upstream.

Move the first command byte write into advance_transaction() so that all
EC register accesses that can affect the command processing state machine
can happen in this asynchronous state machine advancement function.

The advance_transaction() function then can be a complete implementation
of an asyncrhonous transaction for a single command so that:
 1. The first command byte can be written in the interrupt context;
 2. The command completion waiter can also be used to wait the first command
    byte's timeout;
 3. In BURST mode, the follow-up command bytes can be written in the
    interrupt context directly, so that it doesn't need to return to the
    task context. Returning to the task context reduces the throughput of
    the BURST mode and in the worst cases where the system workload is very
    high, this leads to the hardware driven automatic BURST mode exit.

In order not to increase memory consumption, convert 'done' into 'flags'
to contain multiple indications:
 1. ACPI_EC_COMMAND_COMPLETE: converting from original 'done' condition,
    indicating the completion of the command transaction.
 2. ACPI_EC_COMMAND_POLL: indicating the availability of writing the first
    command byte. A new command can utilize this flag to compete for the
    right of accessing the underlying hardware. There is a follow-up bug
    fix that has utilized this new flag.

The 2 flags are important because it also reflects a key concept of IO
programs' design used in the system softwares. Normally an IO program
running in the kernel should first be implemented in the asynchronous way.
And the 2 flags are the most common way to implement its synchronous
operations on top of the asynchronous operations:
1. POLL: This flag can be used to block until the asynchronous operations
         can happen.
2. COMPLETE: This flag can be used to block until the asynchronous
             operations have completed.
By constructing code cleanly in this way, many difficult problems can be
solved smoothly.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=70891
Link: https://bugzilla.kernel.org/show_bug.cgi?id=63931
Link: https://bugzilla.kernel.org/show_bug.cgi?id=59911
Reported-and-tested-by: Gareth Williams <gareth@garethwilliams.me.uk>
Reported-and-tested-by: Hans de Goede <jwrdegoede@fedoraproject.org>
Reported-by: Barton Xu <tank.xuhan@gmail.com>
Tested-by: Steffen Weber <steffen.weber@gmail.com>
Tested-by: Arthur Chen <axchen@nvidia.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/acpi/ec.c | 83 ++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 48 insertions(+), 35 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index f8757316d309..6e091a96d023 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -81,6 +81,9 @@ enum {
 	EC_FLAGS_BLOCKED,		/* Transactions are blocked */
 };
 
+#define ACPI_EC_COMMAND_POLL		0x01 /* Available for command byte */
+#define ACPI_EC_COMMAND_COMPLETE	0x02 /* Completed last byte */
+
 /* ec.c is compiled in acpi namespace so this shows up as acpi.ec_delay param */
 static unsigned int ec_delay __read_mostly = ACPI_EC_DELAY;
 module_param(ec_delay, uint, 0644);
@@ -116,7 +119,7 @@ struct transaction {
 	u8 ri;
 	u8 wlen;
 	u8 rlen;
-	bool done;
+	u8 flags;
 };
 
 struct acpi_ec *boot_ec, *first_ec;
@@ -157,63 +160,68 @@ static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data)
 	outb(data, ec->data_addr);
 }
 
-static int ec_transaction_done(struct acpi_ec *ec)
+static int ec_transaction_completed(struct acpi_ec *ec)
 {
 	unsigned long flags;
 	int ret = 0;
 	spin_lock_irqsave(&ec->lock, flags);
-	if (!ec->curr || ec->curr->done)
+	if (!ec->curr || (ec->curr->flags & ACPI_EC_COMMAND_COMPLETE))
 		ret = 1;
 	spin_unlock_irqrestore(&ec->lock, flags);
 	return ret;
 }
 
-static void start_transaction(struct acpi_ec *ec)
-{
-	ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0;
-	ec->curr->done = false;
-	acpi_ec_write_cmd(ec, ec->curr->command);
-}
-
 static void advance_transaction(struct acpi_ec *ec)
 {
-	unsigned long flags;
 	struct transaction *t;
 	u8 status;
 
-	spin_lock_irqsave(&ec->lock, flags);
 	pr_debug("===== %s =====\n", in_interrupt() ? "IRQ" : "TASK");
 	status = acpi_ec_read_status(ec);
 	t = ec->curr;
 	if (!t)
-		goto unlock;
-	if (t->wlen > t->wi) {
-		if ((status & ACPI_EC_FLAG_IBF) == 0)
-			acpi_ec_write_data(ec,
-				t->wdata[t->wi++]);
-		else
-			goto err;
-	} else if (t->rlen > t->ri) {
-		if ((status & ACPI_EC_FLAG_OBF) == 1) {
-			t->rdata[t->ri++] = acpi_ec_read_data(ec);
-			if (t->rlen == t->ri)
-				t->done = true;
+		goto err;
+	if (t->flags & ACPI_EC_COMMAND_POLL) {
+		if (t->wlen > t->wi) {
+			if ((status & ACPI_EC_FLAG_IBF) == 0)
+				acpi_ec_write_data(ec, t->wdata[t->wi++]);
+			else
+				goto err;
+		} else if (t->rlen > t->ri) {
+			if ((status & ACPI_EC_FLAG_OBF) == 1) {
+				t->rdata[t->ri++] = acpi_ec_read_data(ec);
+				if (t->rlen == t->ri)
+					t->flags |= ACPI_EC_COMMAND_COMPLETE;
+			} else
+				goto err;
+		} else if (t->wlen == t->wi &&
+			   (status & ACPI_EC_FLAG_IBF) == 0)
+			t->flags |= ACPI_EC_COMMAND_COMPLETE;
+		return;
+	} else {
+		if ((status & ACPI_EC_FLAG_IBF) == 0) {
+			acpi_ec_write_cmd(ec, t->command);
+			t->flags |= ACPI_EC_COMMAND_POLL;
 		} else
 			goto err;
-	} else if (t->wlen == t->wi &&
-		   (status & ACPI_EC_FLAG_IBF) == 0)
-		t->done = true;
-	goto unlock;
+		return;
+	}
 err:
 	/*
 	 * If SCI bit is set, then don't think it's a false IRQ
 	 * otherwise will take a not handled IRQ as a false one.
 	 */
-	if (in_interrupt() && !(status & ACPI_EC_FLAG_SCI))
-		++t->irq_count;
+	if (!(status & ACPI_EC_FLAG_SCI)) {
+		if (in_interrupt() && t)
+			++t->irq_count;
+	}
+}
 
-unlock:
-	spin_unlock_irqrestore(&ec->lock, flags);
+static void start_transaction(struct acpi_ec *ec)
+{
+	ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0;
+	ec->curr->flags = 0;
+	advance_transaction(ec);
 }
 
 static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data);
@@ -238,15 +246,17 @@ static int ec_poll(struct acpi_ec *ec)
 			/* don't sleep with disabled interrupts */
 			if (EC_FLAGS_MSI || irqs_disabled()) {
 				udelay(ACPI_EC_MSI_UDELAY);
-				if (ec_transaction_done(ec))
+				if (ec_transaction_completed(ec))
 					return 0;
 			} else {
 				if (wait_event_timeout(ec->wait,
-						ec_transaction_done(ec),
+						ec_transaction_completed(ec),
 						msecs_to_jiffies(1)))
 					return 0;
 			}
+			spin_lock_irqsave(&ec->lock, flags);
 			advance_transaction(ec);
+			spin_unlock_irqrestore(&ec->lock, flags);
 		} while (time_before(jiffies, delay));
 		pr_debug(PREFIX "controller reset, restart transaction\n");
 		spin_lock_irqsave(&ec->lock, flags);
@@ -664,10 +674,13 @@ static int ec_check_sci(struct acpi_ec *ec, u8 state)
 static u32 acpi_ec_gpe_handler(acpi_handle gpe_device,
 	u32 gpe_number, void *data)
 {
+	unsigned long flags;
 	struct acpi_ec *ec = data;
 
+	spin_lock_irqsave(&ec->lock, flags);
 	advance_transaction(ec);
-	if (ec_transaction_done(ec) &&
+	spin_unlock_irqrestore(&ec->lock, flags);
+	if (ec_transaction_completed(ec) &&
 	    (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) {
 		wake_up(&ec->wait);
 		ec_check_sci(ec, acpi_ec_read_status(ec));
-- 
2.0.0


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

* [PATCH 3.12 000/170] 3.12.25-stable review
@ 2014-07-18 12:12 Jiri Slaby
  2014-07-18 12:10 ` [PATCH 3.12 001/170] Revert "aio: fix kernel memory disclosure in io_getevents() introduced in v3.10" Jiri Slaby
                   ` (170 more replies)
  0 siblings, 171 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 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.25 release.
There are 170 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 Sun Jul 20 12:11:21 2014
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.25-rc1.xz
and the diffstat can be found below.

thanks,
js

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


Aaron Lu (1):
  thermal: hwmon: Make the check for critical temp valid consistent

Adam Thomson (1):
  iio: of_iio_channel_get_by_name() returns non-null pointers for error
    legs

Alex Deucher (10):
  vgaswitcheroo: switch the mux to the igp on power down when runpm is
    enabled
  drm/radeon: only apply hdmi bpc pll flags when encoder mode is hdmi
  drm/radeon: fix typo in radeon_connector_is_dp12_capable()
  drm/radeon/dp: fix lane/clock setup for dp 1.2 capable devices
  drm/radeon/atom: fix dithering on certain panels
  drm/radeon/dpm: fix typo in vddci setup for eg/btc
  drm/radeon/dpm: fix vddci setup typo on cayman
  drm/radeon/cik: fix typo in EOP packet
  drm/radeon: fix typo in ci_stop_dpm()
  drm/radeon: fix typo in golden register setup on evergreen

Alex Elder (1):
  rbd: use reference counts for image requests

Alex Smith (1):
  recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in
    modules

Alexandre Demers (1):
  drm/radeon/dpm: Reenabling SS on Cayman

Andras Kovacs (1):
  USB: cp210x: add support for Corsair usb dongle

Anton Blanchard (2):
  powerpc: 64bit sendfile is capped at 2GB
  powerpc/perf: Never program book3s PMCs with values >= 0x80000000

Arik Nemtsov (1):
  mac80211: don't check netdev state for debugfs read/write

Asai Thambi S P (3):
  mtip32xx: Fix ERO and NoSnoop values in PCIe upstream on AMD systems
  mtip32xx: Increase timeout for STANDBY IMMEDIATE command
  mtip32xx: Remove dfs_parent after pci unregister

Axel Lin (3):
  hwmon: (amc6821) Fix permissions for temp2_input
  hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div
  hwmon: (adm1021) Fix cache problem when writing temperature limits

Bart Van Assche (3):
  IB/srp: Fix a sporadic crash triggered by cable pulling
  IB/umad: Fix error handling
  IB/umad: Fix use-after-free on close

Benjamin Herrenschmidt (2):
  powerpc/serial: Use saner flags when creating legacy ports
  powerpc: Add AT_HWCAP2 to indicate V.CRYPTO category support

Bernd Wachter (1):
  usb: option: Add ID for Telewell TW-LTE 4G v2

Bert Vermeulen (1):
  USB: ftdi_sio: Add extra PID.

Bjorn Helgaas (1):
  PCI: Fix incorrect vgaarb conditional in WARN_ON()

Bjørn Mork (1):
  usb: option: add/modify Olivetti Olicard modems

Brian King (2):
  ibmvscsi: Abort init sequence during error recovery
  ibmvscsi: Add memory barriers for send / receive

ChiaHao (1):
  arm64: Bug fix in stack alignment exception

Christian König (1):
  drm/radeon: stop poisoning the GART TLB

Christoph Hellwig (1):
  nfsd: getattr for FATTR4_WORD0_FILES_AVAIL needs the statfs buffer

Colin Cross (1):
  arm64: implement TASK_SIZE_OF

David R. Piegdon (1):
  ARM: OMAP2+: Fix parser-bug in platform muxing code

David Rientjes (1):
  mm, pcp: allow restoring percpu_pagelist_fraction default

Deng-Cheng Zhu (1):
  MIPS: KVM: Fix memory leak on VCPU

Dennis Dalessandro (1):
  IB/ipath: Translate legacy diagpkt into newer extended diagpkt

Emmanuel Grumbach (1):
  iwlwifi: pcie: try to get ownership several times

Eric Sandeen (1):
  ext4: disable synchronous transaction batching if max_batch_time==0

Ezequiel Garcia (1):
  usb: musb: Fix panic upon musb_am335x module removal

Fabio Baltieri (1):
  hwmon: (ina2xx) Cast to s16 on shunt and current regs

Felix Fietkau (1):
  mac80211: fix a memory leak on sta rate selection table

Florian Westphal (1):
  netfilter: nf_nat: fix oops on netns removal

Gabor Juhos (1):
  watchdog: ath79_wdt: avoid spurious restarts on AR934x

Gavin Shan (1):
  powerpc/pseries: Fix overwritten PE state

Greg Kroah-Hartman (1):
  lz4: add overrun checks to lz4_uncompress_unknownoutputsize()

Gu Zheng (1):
  cpuset,mempolicy: fix sleeping function called from invalid context

Guenter Roeck (3):
  hwmon: (emc2103) Clamp limits instead of bailing out
  hwmon: (adm1031) Fix writes to limit registers
  powerpc: Disable RELOCATABLE for COMPILE_TEST with PPC64

Hans de Goede (2):
  Input: elantech - deal with clickpads reporting right button events
  Input: elantech - don't set bit 1 of reg_10 when the no_hw_res quirk
    is set

Hugh Dickins (1):
  mm: fix crashes from mbind() merging vmas

Ilya Dryomov (1):
  rbd: handle parent_overlap on writes correctly

J. Bruce Fields (1):
  nfsd: fix rare symlink decoding bug

Jacob Keller (1):
  Documentation/SubmittingPatches: describe the Fixes: tag

James Hogan (1):
  MIPS: KVM: Remove redundant NULL checks before kfree()

Jan Kara (2):
  ext4: Fix buffer double free in ext4_alloc_branch()
  ext4: Fix hole punching for files with indirect blocks

Jan Kardell (1):
  iio: ti_am335x_adc: Fix: Use same step id at FIFOs both ends

Jeff Mahoney (1):
  reiserfs: call truncate_setsize under tailpack mutex

Jiri Slaby (1):
  Revert "aio: fix kernel memory disclosure in io_getevents() introduced
    in v3.10"

Joe Thornber (1):
  dm io: fix a race condition in the wake up code for sync_io

Joel Stanley (2):
  powerpc/perf: Add PPMU_ARCH_207S define
  powerpc/perf: Clear MMCR2 when enabling PMU

Johan Hedberg (3):
  Bluetooth: Fix SSP acceptor just-works confirmation without MITM
  Bluetooth: Fix indicating discovery state when canceling inquiry
  Bluetooth: Fix locking of hdev when calling into SMP code

Johan Hovold (1):
  USB: ftdi_sio: fix null deref at port probe

Joonsoo Kim (1):
  DMA, CMA: fix possible memory leak

Julian Anastasov (1):
  ipvs: stop tot_stats estimator only under CONFIG_SYSCTL

Jussi Kivilinna (1):
  crypto: sha512_ssse3 - fix byte count to bit count conversion

K. Y. Srinivasan (1):
  Drivers: hv: vmbus: Fix a bug in the channel callback dispatch code

Krzysztof Hałasa (1):
  mac80211: fix IBSS join by initializing last_scan_completed

Krzysztof Kozlowski (1):
  clk: s2mps11: Fix double free corruption during driver unbind

Lan Tianyu (1):
  ACPI / battery: Retry to get battery information if failed during
    probing

Linus Walleij (1):
  usb: musb: ux500: don't propagate the OF node

Lukas Czerner (1):
  dm thin: update discard_granularity to reflect the thin-pool blocksize

Lv Zheng (4):
  ACPI / EC: Avoid race condition related to advance_transaction()
  ACPI / EC: Add asynchronous command byte write support
  ACPI / EC: Remove duplicated ec_wait_ibf0() waiter
  ACPI / EC: Fix race condition in ec_transaction_completed()

Marcin Kraglak (1):
  Bluetooth: Allow change security level on ATT_CID in slave role

Marek Olšák (1):
  drm/radeon: don't allow RADEON_GEM_DOMAIN_CPU for command submission

Markos Chandras (1):
  MIPS: MSC: Prevent out-of-bounds writes to MIPS SC ioremap'd region

Mateusz Guzik (1):
  NFS: populate ->net in mount data when remounting

Mathias Nyman (1):
  xhci: correct burst count field for isoc transfers on 1.0 xhci hosts

Maxime Bizon (1):
  workqueue: fix dev_set_uevent_suppress() imbalance

Maxime Ripard (1):
  net: allwinner: emac: Add missing free_irq

Michael Ellerman (2):
  powerpc/mm: Check paca psize is up to date for huge mappings
  powerpc/perf: Ensure all EBB register state is cleared on fork()

Michael Neuling (1):
  powerpc: Don't setup CPUs with bad status

Michal Nazarewicz (3):
  usb: gadget: f_fs: fix NULL pointer dereference when there are no
    strings
  tools: ffs-test: fix header values endianess
  mm: page_alloc: fix CMA area initialisation when pageblock > MAX_ORDER

Michal Sojka (1):
  USB: serial: ftdi_sio: Add Infineon Triboard

Micky Ching (1):
  mmc: rtsx: add R1-no-CRC mmc command type handle

Mike Marciniszyn (1):
  IB/qib: Fix port in pkey change event

Mikulas Patocka (2):
  iscsi-target: fix iscsit_del_np deadlock on unload
  sym53c8xx_2: Set DID_REQUEUE return code when aborting squeue

Nadav Amit (1):
  KVM: x86: Increase the number of fixed MTRR regs to 10

Naoya Horiguchi (1):
  hugetlb: fix copy_hugetlb_page_range() to handle migration/hwpoisoned
    entry

NeilBrown (1):
  md: flush writes before starting a recovery.

Nicholas Bellinger (3):
  target: Fix left-over se_lun->lun_sep pointer OOPs
  iscsi-target: Avoid rejecting incorrect ITT for Data-Out
  iscsi-target: Explicily clear login response PDU in exception path

Oleg Nesterov (1):
  tracing: Fix syscall_*regfunc() vs copy_process() race

Oliver Neukum (1):
  USB: option: add device ID for SpeedUp SU9800 usb 3g modem

Paolo Bonzini (3):
  virtio-scsi: avoid cancelling uninitialized work items
  virtio-scsi: fix various bad behavior on aborted requests
  KVM: x86: preserve the high 32-bits of the PAT register

Paul Bolle (2):
  powerpc: fix typo 'CONFIG_PMAC'
  powerpc: fix typo 'CONFIG_PPC_CPU'

Pekon Gupta (1):
  mtd: eLBC NAND: fix subpage write support

Peter Chen (1):
  usb: chipidea: udc: delete td from req's td list at ep_dequeue

Peter Christensen (1):
  ipvs: Fix panic due to non-linear skb

Peter Hurley (2):
  serial: Fix IGNBRK handling
  tty: Correct INPCK handling

Prabhakar Lad (1):
  cpufreq: Makefile: fix compilation for davinci platform

Rafał Miłecki (1):
  b43: fix frequency reported on G-PHY with /new/ firmware

Roland Dreier (1):
  x86, ioremap: Speed up check for RAM pages

Sander Eikelenboom (1):
  ALSA: usb-audio: Prevent printk ratelimiting from spamming kernel log
    while DEBUG not defined

Scott Mayhew (1):
  nfs: Fix cache_validity check in nfs_write_pageuptodate()

Scott Wood (1):
  powerpc: Don't skip ePAPR spin-table CPUs

Stanislaw Gruszka (2):
  rt2x00: disable TKIP on USB
  rt2x00: fix rfkill regression on rt2500pci

Steve Capper (1):
  arm64: mm: Make icache synchronisation logic huge page aware

Steve French (1):
  CIFS: fix mount failure with broken pathnames when smb3 mount with
    mapchars option

Steven Rostedt (Red Hat) (3):
  tracing: Try again for saved cmdline if failed due to locking
  tracing: Remove ftrace_stop/start() from reading the trace file
  ring-buffer: Check if buffer exists before polling

Takashi Iwai (1):
  ALSA: usb-audio: Fix races at disconnection and PCM closing

Tejun Heo (2):
  ptrace,x86: force IRET path after a ptrace_stop()
  blkcg: fix use-after-free in __blkg_release_rcu() by making blkcg_gq
    refcnt an atomic_t

Theodore Ts'o (4):
  ext4: fix unjournalled bg descriptor while initializing inode bitmap
  ext4: clarify error count warning messages
  ext4: clarify ext4_error message in ext4_mb_generate_buddy_error()
  ext4: fix a potential deadlock in __ext4_es_shrink()

Thomas Gleixner (7):
  rtmutex: Fix deadlock detector for real
  rtmutex: Detect changes in the pi lock chain
  rtmutex: Handle deadlock detection smarter
  rtmutex: Plug slow unlock race
  usb: musb: Ensure that cppi41 timer gets armed on premature DMA TX irq
  irqchip: spear_shirq: Fix interrupt offset
  clk: spear3xx: Use proper control register offset

Thomas Hellstrom (1):
  drm/vmwgfx: Fix incorrect write to read-only register v2:

Thomas Jarosch (1):
  PCI: Add new ID for Intel GPU "spurious interrupt" quirk

Tim Gardner (1):
  ALSA: usb-audio: Suppress repetitive debug messages from
    retire_playback_urb()

Trond Myklebust (3):
  SUNRPC: Fix a module reference leak in svc_handle_xprt
  pNFS: Handle allocation errors correctly in
    filelayout_alloc_layout_hdr()
  NFS: Don't declare inode uptodate unless all attributes were checked

Ulrich Obergfell (1):
  scsi_error: fix invalid setting of host byte

Ville Syrjälä (1):
  drm/i915: Don't clobber the GTT when it's within stolen memory

Vincent Minet (1):
  intel_pstate: Set CPU number before accessing MSRs

Viresh Kumar (1):
  watchdog: sp805: Set watchdog_device->timeout from ->set_timeout()

Wang, Yu (1):
  xhci: Fix runtime suspended xhci from blocking system suspend.

Yann Droneaud (2):
  IB/mlx5: add missing padding at end of struct mlx5_ib_create_cq
  IB/mlx5: add missing padding at end of struct mlx5_ib_create_srq

Yasuaki Ishimatsu (1):
  workqueue: zero cpumask of wq_numa_possible_cpumask on init

gundberg (1):
  watchdog: kempld-wdt: Use the correct value when configuring the
    prescaler with the watchdog

hujianyang (2):
  UBIFS: fix an mmap and fsync race condition
  UBIFS: Remove incorrect assertion in shrink_tnc()

pekon gupta (1):
  mtd: nand: omap: fix BCHx ecc.correct to return detected bit-flips in
    erased-page

 Documentation/SubmittingPatches              |  22 ++-
 Documentation/sysctl/vm.txt                  |   3 +-
 arch/arm/mach-omap2/mux.c                    |   6 +-
 arch/arm64/include/asm/memory.h              |   2 +
 arch/arm64/kernel/entry.S                    |   1 -
 arch/arm64/mm/flush.c                        |   3 +-
 arch/mips/kernel/irq-msc01.c                 |   2 +-
 arch/mips/kvm/kvm_mips.c                     |  13 +-
 arch/powerpc/Kconfig                         |   3 +-
 arch/powerpc/include/asm/perf_event_server.h |   3 +-
 arch/powerpc/include/asm/switch_to.h         |   2 +
 arch/powerpc/include/asm/systbl.h            |   2 +-
 arch/powerpc/include/uapi/asm/cputable.h     |   1 +
 arch/powerpc/kernel/cputable.c               |   3 +-
 arch/powerpc/kernel/legacy_serial.c          |  15 +-
 arch/powerpc/kernel/setup-common.c           |  10 +-
 arch/powerpc/kernel/time.c                   |   2 +-
 arch/powerpc/lib/sstep.c                     |   2 +-
 arch/powerpc/mm/hash_utils_64.c              |  31 +--
 arch/powerpc/perf/core-book3s.c              |  24 ++-
 arch/powerpc/perf/power8-pmu.c               |   2 +-
 arch/powerpc/platforms/pseries/eeh_pseries.c |   1 +
 arch/x86/crypto/sha512_ssse3_glue.c          |   2 +-
 arch/x86/include/asm/kvm_host.h              |   4 +-
 arch/x86/include/asm/ptrace.h                |  16 ++
 arch/x86/mm/ioremap.c                        |  26 ++-
 block/blk-cgroup.c                           |   7 +-
 block/blk-cgroup.h                           |  17 +-
 drivers/acpi/battery.c                       |  27 ++-
 drivers/acpi/ec.c                            | 128 ++++++-------
 drivers/base/dma-contiguous.c                |  12 +-
 drivers/block/mtip32xx/mtip32xx.c            | 123 ++++++++----
 drivers/block/rbd.c                          |  19 +-
 drivers/clk/clk-s2mps11.c                    |   7 +-
 drivers/clk/spear/spear3xx_clock.c           |   2 +-
 drivers/cpufreq/Makefile                     |   2 +-
 drivers/cpufreq/intel_pstate.c               |   2 +-
 drivers/gpu/drm/i915/i915_gem_stolen.c       |  44 +++++
 drivers/gpu/drm/i915/i915_reg.h              |   3 +
 drivers/gpu/drm/radeon/atombios_crtc.c       |  48 ++---
 drivers/gpu/drm/radeon/atombios_dp.c         |  17 +-
 drivers/gpu/drm/radeon/atombios_encoders.c   |   5 +-
 drivers/gpu/drm/radeon/ci_dpm.c              |   2 +-
 drivers/gpu/drm/radeon/cikd.h                |   2 +-
 drivers/gpu/drm/radeon/cypress_dpm.c         |   2 +-
 drivers/gpu/drm/radeon/evergreen.c           |   8 +-
 drivers/gpu/drm/radeon/ni_dpm.c              |   2 +-
 drivers/gpu/drm/radeon/radeon_connectors.c   |   2 +-
 drivers/gpu/drm/radeon/radeon_cs.c           |   6 +
 drivers/gpu/drm/radeon/rs600.c               |   6 +-
 drivers/gpu/drm/radeon/rv770_dpm.c           |   6 -
 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c           |   1 -
 drivers/gpu/vga/vga_switcheroo.c             |   3 +-
 drivers/hv/connection.c                      |   8 +-
 drivers/hwmon/adm1021.c                      |  14 +-
 drivers/hwmon/adm1029.c                      |   3 +
 drivers/hwmon/adm1031.c                      |   8 +-
 drivers/hwmon/amc6821.c                      |   2 +-
 drivers/hwmon/emc2103.c                      |  15 +-
 drivers/hwmon/ina2xx.c                       |   7 +-
 drivers/iio/adc/ti_am335x_adc.c              |   2 +-
 drivers/iio/inkern.c                         |   6 +-
 drivers/infiniband/core/user_mad.c           |  75 +++++---
 drivers/infiniband/hw/ipath/ipath_diag.c     |   4 +
 drivers/infiniband/hw/mlx5/cq.c              |  13 +-
 drivers/infiniband/hw/mlx5/srq.c             |  14 +-
 drivers/infiniband/hw/mlx5/user.h            |   2 +
 drivers/infiniband/hw/qib/qib_mad.c          |   2 +-
 drivers/infiniband/ulp/srp/ib_srp.c          |   6 +
 drivers/input/mouse/elantech.c               |  27 ++-
 drivers/irqchip/spear-shirq.c                |   2 +-
 drivers/md/dm-io.c                           |  22 +--
 drivers/md/dm-thin.c                         |   3 +-
 drivers/md/md.c                              |  13 ++
 drivers/mmc/host/rtsx_pci_sdmmc.c            |   3 +
 drivers/mtd/nand/fsl_elbc_nand.c             |  14 ++
 drivers/mtd/nand/omap2.c                     |   2 +-
 drivers/net/ethernet/allwinner/sun4i-emac.c  |   1 +
 drivers/net/wireless/b43/xmit.c              |  10 +-
 drivers/net/wireless/iwlwifi/pcie/trans.c    |  26 ++-
 drivers/net/wireless/rt2x00/rt2500pci.c      |   7 +-
 drivers/net/wireless/rt2x00/rt2x00.h         |   1 +
 drivers/net/wireless/rt2x00/rt2x00dev.c      |  24 ++-
 drivers/net/wireless/rt2x00/rt2x00mac.c      |   2 +
 drivers/pci/pci.c                            |   2 +-
 drivers/pci/quirks.c                         |   1 +
 drivers/scsi/ibmvscsi/ibmvscsi.c             |  13 +-
 drivers/scsi/scsi_error.c                    |   2 +-
 drivers/scsi/sym53c8xx_2/sym_hipd.c          |   4 +
 drivers/scsi/virtio_scsi.c                   |  26 ++-
 drivers/target/iscsi/iscsi_target.c          |   2 +-
 drivers/target/iscsi/iscsi_target_login.c    |  13 +-
 drivers/target/iscsi/iscsi_target_util.c     |   2 +
 drivers/target/target_core_device.c          |   1 +
 drivers/thermal/thermal_hwmon.c              |  33 ++--
 drivers/tty/n_tty.c                          |  19 +-
 drivers/tty/serial/8250/8250_core.c          |   2 +-
 drivers/tty/serial/altera_uart.c             |   6 +
 drivers/tty/serial/amba-pl010.c              |   2 +-
 drivers/tty/serial/amba-pl011.c              |   2 +-
 drivers/tty/serial/atmel_serial.c            |   2 +-
 drivers/tty/serial/bcm63xx_uart.c            |   2 +-
 drivers/tty/serial/bfin_uart.c               |   2 +-
 drivers/tty/serial/dz.c                      |   2 +-
 drivers/tty/serial/efm32-uart.c              |   2 +-
 drivers/tty/serial/fsl_lpuart.c              |   2 +-
 drivers/tty/serial/ip22zilog.c               |   2 +-
 drivers/tty/serial/m32r_sio.c                |   2 +-
 drivers/tty/serial/max310x.c                 |   2 +-
 drivers/tty/serial/mcf.c                     |   6 +
 drivers/tty/serial/mfd.c                     |   2 +-
 drivers/tty/serial/mpsc.c                    |   2 +-
 drivers/tty/serial/msm_serial.c              |   2 +-
 drivers/tty/serial/mxs-auart.c               |   2 +-
 drivers/tty/serial/netx-serial.c             |   2 +-
 drivers/tty/serial/pmac_zilog.c              |   2 +-
 drivers/tty/serial/pnx8xxx_uart.c            |   2 +-
 drivers/tty/serial/pxa.c                     |   2 +-
 drivers/tty/serial/sb1250-duart.c            |   2 +-
 drivers/tty/serial/sccnxp.c                  |   2 +-
 drivers/tty/serial/serial_ks8695.c           |   2 +-
 drivers/tty/serial/serial_txx9.c             |   2 +-
 drivers/tty/serial/sirfsoc_uart.c            |   2 +-
 drivers/tty/serial/st-asc.c                  |   2 +-
 drivers/tty/serial/sunsab.c                  |   2 +-
 drivers/tty/serial/sunsu.c                   |   2 +-
 drivers/tty/serial/sunzilog.c                |   2 +-
 drivers/tty/serial/ucc_uart.c                |   2 +-
 drivers/tty/serial/vr41xx_siu.c              |   2 +-
 drivers/tty/serial/zs.c                      |   2 +-
 drivers/usb/chipidea/udc.c                   |   7 +
 drivers/usb/gadget/f_fs.c                    |  12 +-
 drivers/usb/host/xhci-ring.c                 |   2 +-
 drivers/usb/host/xhci.c                      |  10 +-
 drivers/usb/musb/musb_am335x.c               |  23 +--
 drivers/usb/musb/musb_cppi41.c               |   2 +-
 drivers/usb/musb/ux500.c                     |   1 -
 drivers/usb/serial/cp210x.c                  |   1 +
 drivers/usb/serial/ftdi_sio.c                |  12 +-
 drivers/usb/serial/ftdi_sio_ids.h            |   9 +-
 drivers/usb/serial/option.c                  |  28 ++-
 drivers/watchdog/ath79_wdt.c                 |  10 +
 drivers/watchdog/kempld_wdt.c                |   2 +-
 drivers/watchdog/sp805_wdt.c                 |   4 +-
 fs/aio.c                                     |   3 -
 fs/cifs/cifs_unicode.c                       |   7 +-
 fs/ext4/extents_status.c                     |   4 +-
 fs/ext4/ialloc.c                             |  14 +-
 fs/ext4/indirect.c                           |  20 +-
 fs/ext4/mballoc.c                            |   4 +-
 fs/ext4/super.c                              |   9 +-
 fs/jbd2/transaction.c                        |   5 +-
 fs/nfs/inode.c                               |  26 ++-
 fs/nfs/nfs4filelayout.c                      |   2 +-
 fs/nfs/super.c                               |   1 +
 fs/nfs/write.c                               |   4 +-
 fs/nfsd/nfs4proc.c                           |   9 -
 fs/nfsd/nfs4xdr.c                            |  17 +-
 fs/reiserfs/inode.c                          |   8 +-
 fs/ubifs/file.c                              |   3 +-
 fs/ubifs/shrinker.c                          |   1 -
 include/linux/ptrace.h                       |   3 +
 include/linux/ring_buffer.h                  |   2 +-
 include/trace/syscall.h                      |  15 ++
 kernel/cpuset.c                              |   8 +-
 kernel/fork.c                                |   2 +
 kernel/rtmutex-debug.h                       |   5 +
 kernel/rtmutex.c                             | 273 +++++++++++++++++++++++----
 kernel/rtmutex.h                             |   5 +
 kernel/sysctl.c                              |   3 +-
 kernel/trace/ring_buffer.c                   |   5 +-
 kernel/trace/trace.c                         |  40 ++--
 kernel/trace/trace.h                         |   4 +-
 kernel/workqueue.c                           |   3 +-
 lib/lz4/lz4_decompress.c                     |   6 +-
 mm/hugetlb.c                                 |  71 ++++---
 mm/mempolicy.c                               |  48 ++---
 mm/page_alloc.c                              |  56 ++++--
 net/bluetooth/hci_event.c                    |  11 +-
 net/bluetooth/l2cap_sock.c                   |   5 -
 net/bluetooth/mgmt.c                         |   7 +-
 net/mac80211/debugfs_netdev.c                |   6 +-
 net/mac80211/ibss.c                          |   1 +
 net/mac80211/sta_info.c                      |   1 +
 net/netfilter/ipvs/ip_vs_core.c              |  15 +-
 net/netfilter/ipvs/ip_vs_ctl.c               |   2 +-
 net/netfilter/nf_nat_core.c                  |  35 +++-
 net/sunrpc/svc_xprt.c                        |   2 +
 scripts/recordmcount.h                       |   4 +-
 sound/usb/card.c                             |  13 +-
 sound/usb/endpoint.c                         |  17 +-
 sound/usb/endpoint.h                         |   1 +
 sound/usb/pcm.c                              |   3 +-
 tools/usb/ffs-test.c                         |   4 +-
 194 files changed, 1520 insertions(+), 652 deletions(-)

-- 
2.0.0


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

* [PATCH 3.12 143/170] ACPI / EC: Remove duplicated ec_wait_ibf0() waiter
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (141 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 142/170] ACPI / EC: Add asynchronous command byte write support Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 144/170] ACPI / EC: Fix race condition in ec_transaction_completed() Jiri Slaby
                   ` (27 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Lv Zheng, Rafael J. Wysocki, Jiri Slaby

From: Lv Zheng <lv.zheng@intel.com>

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

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

commit 9b80f0f73ae1583c22325ede341c74195847618c upstream.

After we've added the first command byte write into advance_transaction(),
the IBF=0 waiter is duplicated with the command completion waiter
implemented in the ec_poll() because:
   If IBF=1 blocked the first command byte write invoked in the task
   context ec_poll(), it would be kicked off upon IBF=0 interrupt or timed
   out and retried again in the task context.

Remove this seperate and duplicate IBF=0 waiter.  By doing so we can
reduce the overall number of times to access the EC_SC(R) status
register.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=70891
Link: https://bugzilla.kernel.org/show_bug.cgi?id=63931
Link: https://bugzilla.kernel.org/show_bug.cgi?id=59911
Reported-and-tested-by: Gareth Williams <gareth@garethwilliams.me.uk>
Reported-and-tested-by: Hans de Goede <jwrdegoede@fedoraproject.org>
Reported-by: Barton Xu <tank.xuhan@gmail.com>
Tested-by: Steffen Weber <steffen.weber@gmail.com>
Tested-by: Arthur Chen <axchen@nvidia.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/acpi/ec.c | 27 +--------------------------
 1 file changed, 1 insertion(+), 26 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 6e091a96d023..7b52a724a0dd 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -288,23 +288,6 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
 	return ret;
 }
 
-static int ec_check_ibf0(struct acpi_ec *ec)
-{
-	u8 status = acpi_ec_read_status(ec);
-	return (status & ACPI_EC_FLAG_IBF) == 0;
-}
-
-static int ec_wait_ibf0(struct acpi_ec *ec)
-{
-	unsigned long delay = jiffies + msecs_to_jiffies(ec_delay);
-	/* interrupt wait manually if GPE mode is not active */
-	while (time_before(jiffies, delay))
-		if (wait_event_timeout(ec->wait, ec_check_ibf0(ec),
-					msecs_to_jiffies(1)))
-			return 0;
-	return -ETIME;
-}
-
 static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
 {
 	int status;
@@ -325,12 +308,6 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
 			goto unlock;
 		}
 	}
-	if (ec_wait_ibf0(ec)) {
-		pr_err(PREFIX "input buffer is not empty, "
-				"aborting transaction\n");
-		status = -ETIME;
-		goto end;
-	}
 	pr_debug(PREFIX "transaction start (cmd=0x%02x, addr=0x%02x)\n",
 			t->command, t->wdata ? t->wdata[0] : 0);
 	/* disable GPE during transaction if storm is detected */
@@ -354,7 +331,6 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
 		set_bit(EC_FLAGS_GPE_STORM, &ec->flags);
 	}
 	pr_debug(PREFIX "transaction end\n");
-end:
 	if (ec->global_lock)
 		acpi_release_global_lock(glk);
 unlock:
@@ -680,8 +656,7 @@ static u32 acpi_ec_gpe_handler(acpi_handle gpe_device,
 	spin_lock_irqsave(&ec->lock, flags);
 	advance_transaction(ec);
 	spin_unlock_irqrestore(&ec->lock, flags);
-	if (ec_transaction_completed(ec) &&
-	    (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) {
+	if (ec_transaction_completed(ec)) {
 		wake_up(&ec->wait);
 		ec_check_sci(ec, acpi_ec_read_status(ec));
 	}
-- 
2.0.0


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

* [PATCH 3.12 144/170] ACPI / EC: Fix race condition in ec_transaction_completed()
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (142 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 143/170] ACPI / EC: Remove duplicated ec_wait_ibf0() waiter Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 145/170] powerpc/perf: Never program book3s PMCs with values >= 0x80000000 Jiri Slaby
                   ` (26 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Lv Zheng, Rafael J. Wysocki, Jiri Slaby

From: Lv Zheng <lv.zheng@intel.com>

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

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

commit c0d653412fc8450370167a3268b78fc772ff9c87 upstream.

There is a race condition in ec_transaction_completed().

When ec_transaction_completed() is called in the GPE handler, it could
return true because of (ec->curr == NULL). Then the wake_up() invocation
could complete the next command unexpectedly since there is no lock between
the 2 invocations. With the previous cleanup, the IBF=0 waiter race need
not be handled any more. It's now safe to return a flag from
advance_condition() to indicate the requirement of wakeup, the flag is
returned from a locked context.

The ec_transaction_completed() is now only invoked by the ec_poll() where
the ec->curr is ensured to be different from NULL.

After cleaning up, the EVT_SCI=1 check should be moved out of the wakeup
condition so that an EVT_SCI raised with (ec->curr == NULL) can trigger a
QR_SC command.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=70891
Link: https://bugzilla.kernel.org/show_bug.cgi?id=63931
Link: https://bugzilla.kernel.org/show_bug.cgi?id=59911
Reported-and-tested-by: Gareth Williams <gareth@garethwilliams.me.uk>
Reported-and-tested-by: Hans de Goede <jwrdegoede@fedoraproject.org>
Reported-by: Barton Xu <tank.xuhan@gmail.com>
Tested-by: Steffen Weber <steffen.weber@gmail.com>
Tested-by: Arthur Chen <axchen@nvidia.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/acpi/ec.c | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 7b52a724a0dd..7171d52e12ca 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -165,16 +165,17 @@ static int ec_transaction_completed(struct acpi_ec *ec)
 	unsigned long flags;
 	int ret = 0;
 	spin_lock_irqsave(&ec->lock, flags);
-	if (!ec->curr || (ec->curr->flags & ACPI_EC_COMMAND_COMPLETE))
+	if (ec->curr && (ec->curr->flags & ACPI_EC_COMMAND_COMPLETE))
 		ret = 1;
 	spin_unlock_irqrestore(&ec->lock, flags);
 	return ret;
 }
 
-static void advance_transaction(struct acpi_ec *ec)
+static bool advance_transaction(struct acpi_ec *ec)
 {
 	struct transaction *t;
 	u8 status;
+	bool wakeup = false;
 
 	pr_debug("===== %s =====\n", in_interrupt() ? "IRQ" : "TASK");
 	status = acpi_ec_read_status(ec);
@@ -190,21 +191,25 @@ static void advance_transaction(struct acpi_ec *ec)
 		} else if (t->rlen > t->ri) {
 			if ((status & ACPI_EC_FLAG_OBF) == 1) {
 				t->rdata[t->ri++] = acpi_ec_read_data(ec);
-				if (t->rlen == t->ri)
+				if (t->rlen == t->ri) {
 					t->flags |= ACPI_EC_COMMAND_COMPLETE;
+					wakeup = true;
+				}
 			} else
 				goto err;
 		} else if (t->wlen == t->wi &&
-			   (status & ACPI_EC_FLAG_IBF) == 0)
+			   (status & ACPI_EC_FLAG_IBF) == 0) {
 			t->flags |= ACPI_EC_COMMAND_COMPLETE;
-		return;
+			wakeup = true;
+		}
+		return wakeup;
 	} else {
 		if ((status & ACPI_EC_FLAG_IBF) == 0) {
 			acpi_ec_write_cmd(ec, t->command);
 			t->flags |= ACPI_EC_COMMAND_POLL;
 		} else
 			goto err;
-		return;
+		return wakeup;
 	}
 err:
 	/*
@@ -215,13 +220,14 @@ err:
 		if (in_interrupt() && t)
 			++t->irq_count;
 	}
+	return wakeup;
 }
 
 static void start_transaction(struct acpi_ec *ec)
 {
 	ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0;
 	ec->curr->flags = 0;
-	advance_transaction(ec);
+	(void)advance_transaction(ec);
 }
 
 static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data);
@@ -255,7 +261,7 @@ static int ec_poll(struct acpi_ec *ec)
 					return 0;
 			}
 			spin_lock_irqsave(&ec->lock, flags);
-			advance_transaction(ec);
+			(void)advance_transaction(ec);
 			spin_unlock_irqrestore(&ec->lock, flags);
 		} while (time_before(jiffies, delay));
 		pr_debug(PREFIX "controller reset, restart transaction\n");
@@ -654,12 +660,10 @@ static u32 acpi_ec_gpe_handler(acpi_handle gpe_device,
 	struct acpi_ec *ec = data;
 
 	spin_lock_irqsave(&ec->lock, flags);
-	advance_transaction(ec);
-	spin_unlock_irqrestore(&ec->lock, flags);
-	if (ec_transaction_completed(ec)) {
+	if (advance_transaction(ec))
 		wake_up(&ec->wait);
-		ec_check_sci(ec, acpi_ec_read_status(ec));
-	}
+	spin_unlock_irqrestore(&ec->lock, flags);
+	ec_check_sci(ec, acpi_ec_read_status(ec));
 	return ACPI_INTERRUPT_HANDLED | ACPI_REENABLE_GPE;
 }
 
-- 
2.0.0


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

* [PATCH 3.12 145/170] powerpc/perf: Never program book3s PMCs with values >= 0x80000000
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (143 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 144/170] ACPI / EC: Fix race condition in ec_transaction_completed() Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 146/170] powerpc/perf: Add PPMU_ARCH_207S define Jiri Slaby
                   ` (25 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Anton Blanchard, Benjamin Herrenschmidt, Jiri Slaby

From: Anton Blanchard <anton@samba.org>

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

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

commit f56029410a13cae3652d1f34788045c40a13ffc7 upstream.

We are seeing a lot of PMU warnings on POWER8:

    Can't find PMC that caused IRQ

Looking closer, the active PMC is 0 at this point and we took a PMU
exception on the transition from negative to 0. Some versions of POWER8
have an issue where they edge detect and not level detect PMC overflows.

A number of places program the PMC with (0x80000000 - period_left),
where period_left can be negative. We can either fix all of these or
just ensure that period_left is always >= 1.

This patch takes the second option.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/perf/core-book3s.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 29b89e863d7c..023f5adf27b8 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -851,7 +851,22 @@ static void power_pmu_read(struct perf_event *event)
 	} while (local64_cmpxchg(&event->hw.prev_count, prev, val) != prev);
 
 	local64_add(delta, &event->count);
-	local64_sub(delta, &event->hw.period_left);
+
+	/*
+	 * A number of places program the PMC with (0x80000000 - period_left).
+	 * We never want period_left to be less than 1 because we will program
+	 * the PMC with a value >= 0x800000000 and an edge detected PMC will
+	 * roll around to 0 before taking an exception. We have seen this
+	 * on POWER8.
+	 *
+	 * To fix this, clamp the minimum value of period_left to 1.
+	 */
+	do {
+		prev = local64_read(&event->hw.period_left);
+		val = prev - delta;
+		if (val < 1)
+			val = 1;
+	} while (local64_cmpxchg(&event->hw.period_left, prev, val) != prev);
 }
 
 /*
-- 
2.0.0


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

* [PATCH 3.12 146/170] powerpc/perf: Add PPMU_ARCH_207S define
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (144 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 145/170] powerpc/perf: Never program book3s PMCs with values >= 0x80000000 Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 147/170] powerpc/perf: Clear MMCR2 when enabling PMU Jiri Slaby
                   ` (24 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Joel Stanley, Benjamin Herrenschmidt, Jiri Slaby

From: Joel Stanley <joel@jms.id.au>

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

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

commit 4d9690dd56b0d18f2af8a9d4a279cb205aae3345 upstream.

Instead of separate bits for every POWER8 PMU feature, have a single one
for v2.07 of the architecture.

This saves us adding a MMCR2 define for a future patch.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/include/asm/perf_event_server.h | 3 +--
 arch/powerpc/perf/core-book3s.c              | 4 ++--
 arch/powerpc/perf/power8-pmu.c               | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h
index 3fd2f1b6f906..cefc7b4f4fb1 100644
--- a/arch/powerpc/include/asm/perf_event_server.h
+++ b/arch/powerpc/include/asm/perf_event_server.h
@@ -60,8 +60,7 @@ struct power_pmu {
 #define PPMU_SIAR_VALID		0x00000010 /* Processor has SIAR Valid bit */
 #define PPMU_HAS_SSLOT		0x00000020 /* Has sampled slot in MMCRA */
 #define PPMU_HAS_SIER		0x00000040 /* Has SIER */
-#define PPMU_BHRB		0x00000080 /* has BHRB feature enabled */
-#define PPMU_EBB		0x00000100 /* supports event based branch */
+#define PPMU_ARCH_207S		0x00000080 /* PMC is architecture v2.07S */
 
 /*
  * Values for flags to get_alternatives()
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 023f5adf27b8..53cf36206ec6 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -483,7 +483,7 @@ static bool is_ebb_event(struct perf_event *event)
 	 * check that the PMU supports EBB, meaning those that don't can still
 	 * use bit 63 of the event code for something else if they wish.
 	 */
-	return (ppmu->flags & PPMU_EBB) &&
+	return (ppmu->flags & PPMU_ARCH_207S) &&
 	       ((event->attr.config >> PERF_EVENT_CONFIG_EBB_SHIFT) & 1);
 }
 
@@ -1562,7 +1562,7 @@ static int power_pmu_event_init(struct perf_event *event)
 
 	if (has_branch_stack(event)) {
 	        /* PMU has BHRB enabled */
-		if (!(ppmu->flags & PPMU_BHRB))
+		if (!(ppmu->flags & PPMU_ARCH_207S))
 			return -EOPNOTSUPP;
 	}
 
diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c
index a3f7abd2f13f..79b7e200c0e7 100644
--- a/arch/powerpc/perf/power8-pmu.c
+++ b/arch/powerpc/perf/power8-pmu.c
@@ -608,7 +608,7 @@ static struct power_pmu power8_pmu = {
 	.get_constraint		= power8_get_constraint,
 	.get_alternatives	= power8_get_alternatives,
 	.disable_pmc		= power8_disable_pmc,
-	.flags			= PPMU_HAS_SSLOT | PPMU_HAS_SIER | PPMU_BHRB | PPMU_EBB,
+	.flags			= PPMU_HAS_SSLOT | PPMU_HAS_SIER | PPMU_ARCH_207S,
 	.n_generic		= ARRAY_SIZE(power8_generic_events),
 	.generic_events		= power8_generic_events,
 	.attr_groups		= power8_pmu_attr_groups,
-- 
2.0.0


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

* [PATCH 3.12 147/170] powerpc/perf: Clear MMCR2 when enabling PMU
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (145 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 146/170] powerpc/perf: Add PPMU_ARCH_207S define Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 148/170] cpufreq: Makefile: fix compilation for davinci platform Jiri Slaby
                   ` (23 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Joel Stanley, Benjamin Herrenschmidt, Jiri Slaby

From: Joel Stanley <joel@jms.id.au>

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

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

commit b50a6c584bb47b370f84bfd746770c0bbe7129b7 upstream.

On POWER8 when switching to a KVM guest we set bits in MMCR2 to freeze
the PMU counters. Aside from on boot they are then never reset,
resulting in stuck perf counters for any user in the guest or host.

We now set MMCR2 to 0 whenever enabling the PMU, which provides a sane
state for perf to use the PMU counters under either the guest or the
host.

This was manifesting as a bug with ppc64_cpu --frequency:

    $ sudo ppc64_cpu --frequency
    WARNING: couldn't run on cpu 0
    WARNING: couldn't run on cpu 8
      ...
    WARNING: couldn't run on cpu 144
    WARNING: couldn't run on cpu 152
    min:    18446744073.710 GHz (cpu -1)
    max:    0.000 GHz (cpu -1)
    avg:    0.000 GHz

The command uses a perf counter to measure CPU cycles over a fixed
amount of time, in order to approximate the frequency of the machine.
The counters were returning zero once a guest was started, regardless of
weather it was still running or had been shut down.

By dumping the value of MMCR2, it was observed that once a guest is
running MMCR2 is set to 1s - which stops counters from running:

    $ sudo sh -c 'echo p > /proc/sysrq-trigger'
    CPU: 0 PMU registers, ppmu = POWER8 n_counters = 6
    PMC1:  5b635e38 PMC2: 00000000 PMC3: 00000000 PMC4: 00000000
    PMC5:  1bf5a646 PMC6: 5793d378 PMC7: deadbeef PMC8: deadbeef
    MMCR0: 0000000080000000 MMCR1: 000000001e000000 MMCRA: 0000040000000000
    MMCR2: fffffffffffffc00 EBBHR: 0000000000000000
    EBBRR: 0000000000000000 BESCR: 0000000000000000
    SIAR:  00000000000a51cc SDAR:  c00000000fc40000 SIER:  0000000001000000

This is done unconditionally in book3s_hv_interrupts.S upon entering the
guest, and the original value is only save/restored if the host has
indicated it was using the PMU. This is okay, however the user of the
PMU needs to ensure that it is in a defined state when it starts using
it.

Fixes: e05b9b9e5c10 ("powerpc/perf: Power8 PMU support")
Signed-off-by: Joel Stanley <joel@jms.id.au>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/perf/core-book3s.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 53cf36206ec6..57a8ff90ed60 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -1164,6 +1164,9 @@ static void power_pmu_enable(struct pmu *pmu)
 	mb();
 	write_mmcr0(cpuhw, mmcr0);
 
+	if (ppmu->flags & PPMU_ARCH_207S)
+		mtspr(SPRN_MMCR2, 0);
+
 	/*
 	 * Enable instruction sampling if necessary
 	 */
-- 
2.0.0


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

* [PATCH 3.12 148/170] cpufreq: Makefile: fix compilation for davinci platform
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (146 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 147/170] powerpc/perf: Clear MMCR2 when enabling PMU Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 149/170] crypto: sha512_ssse3 - fix byte count to bit count conversion Jiri Slaby
                   ` (22 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Prabhakar Lad, Rafael J. Wysocki, Jiri Slaby

From: Prabhakar Lad <prabhakar.csengg@gmail.com>

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

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

commit 5a90af67c2126fe1d04ebccc1f8177e6ca70d3a9 upstream.

Since commtit 8a7b1227e303 (cpufreq: davinci: move cpufreq driver to
drivers/cpufreq) this added dependancy only for CONFIG_ARCH_DAVINCI_DA850
where as davinci_cpufreq_init() call is used by all davinci platform.

This patch fixes following build error:

arch/arm/mach-davinci/built-in.o: In function `davinci_init_late':
:(.init.text+0x928): undefined reference to `davinci_cpufreq_init'
make: *** [vmlinux] Error 1

Fixes: 8a7b1227e303 (cpufreq: davinci: move cpufreq driver to drivers/cpufreq)
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.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/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index ad5866c2ada0..c2df33ba23c2 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -50,7 +50,7 @@ obj-$(CONFIG_ARM_BIG_LITTLE_CPUFREQ)	+= arm_big_little.o
 # LITTLE drivers, so that it is probed last.
 obj-$(CONFIG_ARM_DT_BL_CPUFREQ)		+= arm_big_little_dt.o
 
-obj-$(CONFIG_ARCH_DAVINCI_DA850)	+= davinci-cpufreq.o
+obj-$(CONFIG_ARCH_DAVINCI)		+= davinci-cpufreq.o
 obj-$(CONFIG_UX500_SOC_DB8500)		+= dbx500-cpufreq.o
 obj-$(CONFIG_ARM_EXYNOS_CPUFREQ)	+= exynos-cpufreq.o
 obj-$(CONFIG_ARM_EXYNOS4210_CPUFREQ)	+= exynos4210-cpufreq.o
-- 
2.0.0


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

* [PATCH 3.12 149/170] crypto: sha512_ssse3 - fix byte count to bit count conversion
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (147 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 148/170] cpufreq: Makefile: fix compilation for davinci platform Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 150/170] arm64: implement TASK_SIZE_OF Jiri Slaby
                   ` (21 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jussi Kivilinna, Herbert Xu, Jiri Slaby

From: Jussi Kivilinna <jussi.kivilinna@iki.fi>

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

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

commit cfe82d4f45c7cc39332a2be7c4c1d3bf279bbd3d upstream.

Byte-to-bit-count computation is only partly converted to big-endian and is
mixing in CPU-endian values. Problem was noticed by sparce with warning:

  CHECK   arch/x86/crypto/sha512_ssse3_glue.c
arch/x86/crypto/sha512_ssse3_glue.c:144:19: warning: restricted __be64 degrades to integer
arch/x86/crypto/sha512_ssse3_glue.c:144:17: warning: incorrect type in assignment (different base types)
arch/x86/crypto/sha512_ssse3_glue.c:144:17:    expected restricted __be64 <noident>
arch/x86/crypto/sha512_ssse3_glue.c:144:17:    got unsigned long long

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Acked-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/crypto/sha512_ssse3_glue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/crypto/sha512_ssse3_glue.c b/arch/x86/crypto/sha512_ssse3_glue.c
index f30cd10293f0..8626b03e83b7 100644
--- a/arch/x86/crypto/sha512_ssse3_glue.c
+++ b/arch/x86/crypto/sha512_ssse3_glue.c
@@ -141,7 +141,7 @@ static int sha512_ssse3_final(struct shash_desc *desc, u8 *out)
 
 	/* save number of bits */
 	bits[1] = cpu_to_be64(sctx->count[0] << 3);
-	bits[0] = cpu_to_be64(sctx->count[1] << 3) | sctx->count[0] >> 61;
+	bits[0] = cpu_to_be64(sctx->count[1] << 3 | sctx->count[0] >> 61);
 
 	/* Pad out to 112 mod 128 and append length */
 	index = sctx->count[0] & 0x7f;
-- 
2.0.0


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

* [PATCH 3.12 150/170] arm64: implement TASK_SIZE_OF
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (148 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 149/170] crypto: sha512_ssse3 - fix byte count to bit count conversion Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 151/170] clk: spear3xx: Use proper control register offset Jiri Slaby
                   ` (20 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Colin Cross, Catalin Marinas, Jiri Slaby

From: Colin Cross <ccross@android.com>

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

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

commit fa2ec3ea10bd377f9d55772b1dab65178425a1a2 upstream.

include/linux/sched.h implements TASK_SIZE_OF as TASK_SIZE if it
is not set by the architecture headers.  TASK_SIZE uses the
current task to determine the size of the virtual address space.
On a 64-bit kernel this will cause reading /proc/pid/pagemap of a
64-bit process from a 32-bit process to return EOF when it reads
past 0xffffffff.

Implement TASK_SIZE_OF exactly the same as TASK_SIZE with
test_tsk_thread_flag instead of test_thread_flag.

Signed-off-by: Colin Cross <ccross@android.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm64/include/asm/memory.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index 20925bcf4e2a..e1134d04e07e 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -51,6 +51,8 @@
 #define TASK_SIZE_32		UL(0x100000000)
 #define TASK_SIZE		(test_thread_flag(TIF_32BIT) ? \
 				TASK_SIZE_32 : TASK_SIZE_64)
+#define TASK_SIZE_OF(tsk)	(test_tsk_thread_flag(tsk, TIF_32BIT) ? \
+				TASK_SIZE_32 : TASK_SIZE_64)
 #else
 #define TASK_SIZE		TASK_SIZE_64
 #endif /* CONFIG_COMPAT */
-- 
2.0.0


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

* [PATCH 3.12 151/170] clk: spear3xx: Use proper control register offset
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (149 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 150/170] arm64: implement TASK_SIZE_OF Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 152/170] clk: s2mps11: Fix double free corruption during driver unbind Jiri Slaby
                   ` (19 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Thomas Gleixner, Mike Turquette, Jiri Slaby

From: Thomas Gleixner <tglx@linutronix.de>

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

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

commit 15ebb05248d025534773c9ef64915bd888f04e4b upstream.

The control register is at offset 0x10, not 0x0. This is wreckaged
since commit 5df33a62c (SPEAr: Switch to common clock framework).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/clk/spear/spear3xx_clock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/spear/spear3xx_clock.c b/drivers/clk/spear/spear3xx_clock.c
index c2d204315546..125eba86c844 100644
--- a/drivers/clk/spear/spear3xx_clock.c
+++ b/drivers/clk/spear/spear3xx_clock.c
@@ -211,7 +211,7 @@ static inline void spear310_clk_init(void) { }
 /* array of all spear 320 clock lookups */
 #ifdef CONFIG_MACH_SPEAR320
 
-#define SPEAR320_CONTROL_REG		(soc_config_base + 0x0000)
+#define SPEAR320_CONTROL_REG		(soc_config_base + 0x0010)
 #define SPEAR320_EXT_CTRL_REG		(soc_config_base + 0x0018)
 
 	#define SPEAR320_UARTX_PCLK_MASK		0x1
-- 
2.0.0


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

* [PATCH 3.12 152/170] clk: s2mps11: Fix double free corruption during driver unbind
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (150 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 151/170] clk: spear3xx: Use proper control register offset Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 153/170] Drivers: hv: vmbus: Fix a bug in the channel callback dispatch code Jiri Slaby
                   ` (18 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Krzysztof Kozlowski, Mike Turquette, Jiri Slaby

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

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

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

commit 2a96dfa49c83a2a7cbdb11382976aaa6b2636764 upstream.

After unbinding the driver memory was corrupted by double free of
clk_lookup structure. This lead to OOPS when re-binding the driver
again.

The driver allocated memory for 'clk_lookup' with devm_kzalloc. During
driver removal this memory was freed twice: once by clkdev_drop() and
second by devm code.

Kernel panic log:
[   30.839284] Unable to handle kernel paging request at virtual address 5f343173
[   30.846476] pgd = dee14000
[   30.849165] [5f343173] *pgd=00000000
[   30.852703] Internal error: Oops: 805 [#1] PREEMPT SMP ARM
[   30.858166] Modules linked in:
[   30.861208] CPU: 0 PID: 1 Comm: bash Not tainted 3.16.0-rc2-00239-g94bdf617b07e-dirty #40
[   30.869364] task: df478000 ti: df480000 task.ti: df480000
[   30.874752] PC is at clkdev_add+0x2c/0x38
[   30.878738] LR is at clkdev_add+0x18/0x38
[   30.882732] pc : [<c0350908>]    lr : [<c03508f4>]    psr: 60000013
[   30.882732] sp : df481e78  ip : 00000001  fp : c0700ed8
[   30.894187] r10: 0000000c  r9 : 00000000  r8 : c07b0e3c
[   30.899396] r7 : 00000002  r6 : df45f9d0  r5 : df421390  r4 : c0700d6c
[   30.905906] r3 : 5f343173  r2 : c0700d84  r1 : 60000013  r0 : c0700d6c
[   30.912417] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[   30.919534] Control: 10c53c7d  Table: 5ee1406a  DAC: 00000015
[   30.925262] Process bash (pid: 1, stack limit = 0xdf480240)
[   30.930817] Stack: (0xdf481e78 to 0xdf482000)
[   30.935159] 1e60:                                                       00001000 df6de610
[   30.943321] 1e80: df7f4558 c0355650 c05ec6ec c0700eb0 df6de600 df7f4510 dec9d69c 00000014
[   30.951480] 1ea0: 00167b48 df6de610 c0700e30 c0713518 00000000 c0700e30 dec9d69c 00000006
[   30.959639] 1ec0: 00167b48 c02c1b7c c02c1b64 df6de610 c07aff48 c02c0420 c06fb150 c047cc20
[   30.967798] 1ee0: df6de610 df6de610 c0700e30 df6de644 c06fb150 0000000c dec9d690 c02bef90
[   30.975957] 1f00: dec9c6c0 dece4c00 df481f80 dece4c00 0000000c c02be73c 0000000c c016ca8c
[   30.984116] 1f20: c016ca48 00000000 00000000 c016c1f4 00000000 00000000 b6f18000 df481f80
[   30.992276] 1f40: df7f66c0 0000000c df480000 df480000 b6f18000 c011094c df47839c 60000013
[   31.000435] 1f60: 00000000 00000000 df7f66c0 df7f66c0 0000000c df480000 b6f18000 c0110dd4
[   31.008594] 1f80: 00000000 00000000 0000000c b6ec05d8 0000000c b6f18000 00000004 c000f2a8
[   31.016753] 1fa0: 00001000 c000f0e0 b6ec05d8 0000000c 00000001 b6f18000 0000000c 00000000
[   31.024912] 1fc0: b6ec05d8 0000000c b6f18000 00000004 0000000c 00000001 00000000 00167b48
[   31.033071] 1fe0: 00000000 bed83a80 b6e004f0 b6e5122c 60000010 00000001 ffffffff ffffffff
[   31.041248] [<c0350908>] (clkdev_add) from [<c0355650>] (s2mps11_clk_probe+0x2b4/0x3b4)
[   31.049223] [<c0355650>] (s2mps11_clk_probe) from [<c02c1b7c>] (platform_drv_probe+0x18/0x48)
[   31.057728] [<c02c1b7c>] (platform_drv_probe) from [<c02c0420>] (driver_probe_device+0x13c/0x384)
[   31.066579] [<c02c0420>] (driver_probe_device) from [<c02bef90>] (bind_store+0x88/0xd8)
[   31.074564] [<c02bef90>] (bind_store) from [<c02be73c>] (drv_attr_store+0x20/0x2c)
[   31.082118] [<c02be73c>] (drv_attr_store) from [<c016ca8c>] (sysfs_kf_write+0x44/0x48)
[   31.090016] [<c016ca8c>] (sysfs_kf_write) from [<c016c1f4>] (kernfs_fop_write+0xc0/0x17c)
[   31.098176] [<c016c1f4>] (kernfs_fop_write) from [<c011094c>] (vfs_write+0xa0/0x1c4)
[   31.105899] [<c011094c>] (vfs_write) from [<c0110dd4>] (SyS_write+0x40/0x8c)
[   31.112931] [<c0110dd4>] (SyS_write) from [<c000f0e0>] (ret_fast_syscall+0x0/0x3c)
[   31.120481] Code: e2842018 e584501c e1a00004 e885000c (e5835000)
[   31.126596] ---[ end trace efad45bfa3a61b05 ]---
[   31.131181] Kernel panic - not syncing: Fatal exception
[   31.136368] CPU1: stopping
[   31.139054] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G      D       3.16.0-rc2-00239-g94bdf617b07e-dirty #40
[   31.148697] [<c0016480>] (unwind_backtrace) from [<c0012950>] (show_stack+0x10/0x14)
[   31.156419] [<c0012950>] (show_stack) from [<c0480db8>] (dump_stack+0x80/0xcc)
[   31.163622] [<c0480db8>] (dump_stack) from [<c001499c>] (handle_IPI+0x130/0x15c)
[   31.170998] [<c001499c>] (handle_IPI) from [<c000862c>] (gic_handle_irq+0x60/0x68)
[   31.178549] [<c000862c>] (gic_handle_irq) from [<c0013480>] (__irq_svc+0x40/0x70)
[   31.186009] Exception stack(0xdf4bdf88 to 0xdf4bdfd0)
[   31.191046] df80:                   ffffffed 00000000 00000000 00000000 df4bc000 c06d042c
[   31.199207] dfa0: 00000000 ffffffed c06d03c0 00000000 c070c288 00000000 00000000 df4bdfd0
[   31.207363] dfc0: c0010324 c0010328 60000013 ffffffff
[   31.212402] [<c0013480>] (__irq_svc) from [<c0010328>] (arch_cpu_idle+0x28/0x30)
[   31.219783] [<c0010328>] (arch_cpu_idle) from [<c005f150>] (cpu_startup_entry+0x2c4/0x3f0)
[   31.228027] [<c005f150>] (cpu_startup_entry) from [<400086c4>] (0x400086c4)
[   31.234968] ---[ end Kernel panic - not syncing: Fatal exception

Fixes: 7cc560dea415 ("clk: s2mps11: Add support for s2mps11")
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/clk/clk-s2mps11.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
index aa21299ec7d2..bea59229a037 100644
--- a/drivers/clk/clk-s2mps11.c
+++ b/drivers/clk/clk-s2mps11.c
@@ -190,16 +190,13 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
 			goto err_reg;
 		}
 
-		s2mps11_clk->lookup = devm_kzalloc(&pdev->dev,
-					sizeof(struct clk_lookup), GFP_KERNEL);
+		s2mps11_clk->lookup = clkdev_alloc(s2mps11_clk->clk,
+					s2mps11_name(s2mps11_clk), NULL);
 		if (!s2mps11_clk->lookup) {
 			ret = -ENOMEM;
 			goto err_lup;
 		}
 
-		s2mps11_clk->lookup->con_id = s2mps11_name(s2mps11_clk);
-		s2mps11_clk->lookup->clk = s2mps11_clk->clk;
-
 		clkdev_add(s2mps11_clk->lookup);
 	}
 
-- 
2.0.0


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

* [PATCH 3.12 153/170] Drivers: hv: vmbus: Fix a bug in the channel callback dispatch code
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (151 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 152/170] clk: s2mps11: Fix double free corruption during driver unbind Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 154/170] dm io: fix a race condition in the wake up code for sync_io Jiri Slaby
                   ` (17 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, K. Y. Srinivasan, Jiri Slaby

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

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

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

commit affb1aff300ddee54df307812b38f166e8a865ef upstream.

Starting with Win8, we have implemented several optimizations to improve the
scalability and performance of the VMBUS transport between the Host and the
Guest. Some of the non-performance critical services cannot leverage these
optimization since they only read and process one message at a time.
Make adjustments to the callback dispatch code to account for the way
non-performance critical drivers handle reading of the channel.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hv/connection.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index 8dd98d4fc124..59ef4e7afdd7 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -320,9 +320,13 @@ static void process_chn_event(u32 relid)
 		 */
 
 		do {
-			hv_begin_read(&channel->inbound);
+			if (read_state)
+				hv_begin_read(&channel->inbound);
 			channel->onchannel_callback(arg);
-			bytes_to_read = hv_end_read(&channel->inbound);
+			if (read_state)
+				bytes_to_read = hv_end_read(&channel->inbound);
+			else
+				bytes_to_read = 0;
 		} while (read_state && (bytes_to_read != 0));
 	} else {
 		pr_err("no channel callback for relid - %u\n", relid);
-- 
2.0.0


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

* [PATCH 3.12 154/170] dm io: fix a race condition in the wake up code for sync_io
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (152 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 153/170] Drivers: hv: vmbus: Fix a bug in the channel callback dispatch code Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 155/170] intel_pstate: Set CPU number before accessing MSRs Jiri Slaby
                   ` (16 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Joe Thornber, Mike Snitzer, Jiri Slaby

From: Joe Thornber <thornber@redhat.com>

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

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

commit 10f1d5d111e8aed46a0f1179faf9a3cf422f689e upstream.

There's a race condition between the atomic_dec_and_test(&io->count)
in dec_count() and the waking of the sync_io() thread.  If the thread
is spuriously woken immediately after the decrement it may exit,
making the on stack io struct invalid, yet the dec_count could still
be using it.

Fix this race by using a completion in sync_io() and dec_count().

Reported-by: Minfei Huang <huangminfei@ucloud.cn>
Signed-off-by: Joe Thornber <thornber@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Acked-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/md/dm-io.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c
index 2a20986a2fec..e60c2eaea7bb 100644
--- a/drivers/md/dm-io.c
+++ b/drivers/md/dm-io.c
@@ -10,6 +10,7 @@
 #include <linux/device-mapper.h>
 
 #include <linux/bio.h>
+#include <linux/completion.h>
 #include <linux/mempool.h>
 #include <linux/module.h>
 #include <linux/sched.h>
@@ -32,7 +33,7 @@ struct dm_io_client {
 struct io {
 	unsigned long error_bits;
 	atomic_t count;
-	struct task_struct *sleeper;
+	struct completion *wait;
 	struct dm_io_client *client;
 	io_notify_fn callback;
 	void *context;
@@ -121,8 +122,8 @@ static void dec_count(struct io *io, unsigned int region, int error)
 			invalidate_kernel_vmap_range(io->vma_invalidate_address,
 						     io->vma_invalidate_size);
 
-		if (io->sleeper)
-			wake_up_process(io->sleeper);
+		if (io->wait)
+			complete(io->wait);
 
 		else {
 			unsigned long r = io->error_bits;
@@ -385,6 +386,7 @@ static int sync_io(struct dm_io_client *client, unsigned int num_regions,
 	 */
 	volatile char io_[sizeof(struct io) + __alignof__(struct io) - 1];
 	struct io *io = (struct io *)PTR_ALIGN(&io_, __alignof__(struct io));
+	DECLARE_COMPLETION_ONSTACK(wait);
 
 	if (num_regions > 1 && (rw & RW_MASK) != WRITE) {
 		WARN_ON(1);
@@ -393,7 +395,7 @@ static int sync_io(struct dm_io_client *client, unsigned int num_regions,
 
 	io->error_bits = 0;
 	atomic_set(&io->count, 1); /* see dispatch_io() */
-	io->sleeper = current;
+	io->wait = &wait;
 	io->client = client;
 
 	io->vma_invalidate_address = dp->vma_invalidate_address;
@@ -401,15 +403,7 @@ static int sync_io(struct dm_io_client *client, unsigned int num_regions,
 
 	dispatch_io(rw, num_regions, where, dp, io, 1);
 
-	while (1) {
-		set_current_state(TASK_UNINTERRUPTIBLE);
-
-		if (!atomic_read(&io->count))
-			break;
-
-		io_schedule();
-	}
-	set_current_state(TASK_RUNNING);
+	wait_for_completion_io(&wait);
 
 	if (error_bits)
 		*error_bits = io->error_bits;
@@ -432,7 +426,7 @@ static int async_io(struct dm_io_client *client, unsigned int num_regions,
 	io = mempool_alloc(client->pool, GFP_NOIO);
 	io->error_bits = 0;
 	atomic_set(&io->count, 1); /* see dispatch_io() */
-	io->sleeper = NULL;
+	io->wait = NULL;
 	io->client = client;
 	io->callback = fn;
 	io->context = context;
-- 
2.0.0


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

* [PATCH 3.12 155/170] intel_pstate: Set CPU number before accessing MSRs
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (153 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 154/170] dm io: fix a race condition in the wake up code for sync_io Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 156/170] ext4: fix unjournalled bg descriptor while initializing inode bitmap Jiri Slaby
                   ` (15 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Vincent Minet, Rafael J. Wysocki, Jiri Slaby

From: Vincent Minet <vincent@vincent-minet.net>

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

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

commit 179e8471673ce0249cd4ecda796008f7757e5bad upstream.

Ensure that cpu->cpu is set before writing MSR_IA32_PERF_CTL during CPU
initialization. Otherwise only cpu0 has its P-state set and all other
cores are left with their values unchanged.

In most cases, this is not too serious because the P-states will be set
correctly when the timer function is run.  But when the default governor
is set to performance, the per-CPU current_pstate stays the same forever
and no attempts are made to write the MSRs again.

Signed-off-by: Vincent Minet <vincent@vincent-minet.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/cpufreq/intel_pstate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index d5dc567efd96..f033fadb58e6 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -550,6 +550,7 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
 
 	cpu = all_cpu_data[cpunum];
 
+	cpu->cpu = cpunum;
 	intel_pstate_get_cpu_pstates(cpu);
 	if (!cpu->pstate.current_pstate) {
 		all_cpu_data[cpunum] = NULL;
@@ -557,7 +558,6 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
 		return -ENODATA;
 	}
 
-	cpu->cpu = cpunum;
 	cpu->pstate_policy =
 		(struct pstate_adjust_policy *)id->driver_data;
 	init_timer_deferrable(&cpu->timer);
-- 
2.0.0


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

* [PATCH 3.12 156/170] ext4: fix unjournalled bg descriptor while initializing inode bitmap
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (154 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 155/170] intel_pstate: Set CPU number before accessing MSRs Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 157/170] ext4: clarify error count warning messages Jiri Slaby
                   ` (14 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Theodore Ts'o, Jiri Slaby

From: Theodore Ts'o <tytso@mit.edu>

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

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

commit 61c219f5814277ecb71d64cb30297028d6665979 upstream.

The first time that we allocate from an uninitialized inode allocation
bitmap, if the block allocation bitmap is also uninitalized, we need
to get write access to the block group descriptor before we start
modifying the block group descriptor flags and updating the free block
count, etc.  Otherwise, there is the potential of a bad journal
checksum (if journal checksums are enabled), and of the file system
becoming inconsistent if we crash at exactly the wrong time.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/ext4/ialloc.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 137193ff389b..5b5971c20af1 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -851,6 +851,13 @@ got:
 		goto out;
 	}
 
+	BUFFER_TRACE(group_desc_bh, "get_write_access");
+	err = ext4_journal_get_write_access(handle, group_desc_bh);
+	if (err) {
+		ext4_std_error(sb, err);
+		goto out;
+	}
+
 	/* We may have to initialize the block bitmap if it isn't already */
 	if (ext4_has_group_desc_csum(sb) &&
 	    gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
@@ -887,13 +894,6 @@ got:
 		}
 	}
 
-	BUFFER_TRACE(group_desc_bh, "get_write_access");
-	err = ext4_journal_get_write_access(handle, group_desc_bh);
-	if (err) {
-		ext4_std_error(sb, err);
-		goto out;
-	}
-
 	/* Update the relevant bg descriptor fields */
 	if (ext4_has_group_desc_csum(sb)) {
 		int free;
-- 
2.0.0


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

* [PATCH 3.12 157/170] ext4: clarify error count warning messages
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (155 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 156/170] ext4: fix unjournalled bg descriptor while initializing inode bitmap Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 158/170] ext4: clarify ext4_error message in ext4_mb_generate_buddy_error() Jiri Slaby
                   ` (13 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Theodore Ts'o, Pavel Machek, Jiri Slaby

From: Theodore Ts'o <tytso@mit.edu>

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

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

commit ae0f78de2c43b6fadd007c231a352b13b5be8ed2 upstream.

Make it clear that values printed are times, and that it is error
since last fsck. Also add note about fsck version required.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/ext4/super.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index d9711dc42164..a8b886851ff6 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2762,10 +2762,11 @@ static void print_daily_error_info(unsigned long arg)
 	es = sbi->s_es;
 
 	if (es->s_error_count)
-		ext4_msg(sb, KERN_NOTICE, "error count: %u",
+		/* fsck newer than v1.41.13 is needed to clean this condition. */
+		ext4_msg(sb, KERN_NOTICE, "error count since last fsck: %u",
 			 le32_to_cpu(es->s_error_count));
 	if (es->s_first_error_time) {
-		printk(KERN_NOTICE "EXT4-fs (%s): initial error at %u: %.*s:%d",
+		printk(KERN_NOTICE "EXT4-fs (%s): initial error at time %u: %.*s:%d",
 		       sb->s_id, le32_to_cpu(es->s_first_error_time),
 		       (int) sizeof(es->s_first_error_func),
 		       es->s_first_error_func,
@@ -2779,7 +2780,7 @@ static void print_daily_error_info(unsigned long arg)
 		printk("\n");
 	}
 	if (es->s_last_error_time) {
-		printk(KERN_NOTICE "EXT4-fs (%s): last error at %u: %.*s:%d",
+		printk(KERN_NOTICE "EXT4-fs (%s): last error at time %u: %.*s:%d",
 		       sb->s_id, le32_to_cpu(es->s_last_error_time),
 		       (int) sizeof(es->s_last_error_func),
 		       es->s_last_error_func,
-- 
2.0.0


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

* [PATCH 3.12 158/170] ext4: clarify ext4_error message in ext4_mb_generate_buddy_error()
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (156 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 157/170] ext4: clarify error count warning messages Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 159/170] ext4: disable synchronous transaction batching if max_batch_time==0 Jiri Slaby
                   ` (12 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Theodore Ts'o, Jiri Slaby

From: Theodore Ts'o <tytso@mit.edu>

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

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

commit 94d4c066a4ff170a2671b1a9b153febbf36796f6 upstream.

We are spending a lot of time explaining to users what this error
means.  Let's try to improve the message to avoid this problem.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/ext4/mballoc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 08ddfdac955c..502f0fd71470 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -751,8 +751,8 @@ void ext4_mb_generate_buddy(struct super_block *sb,
 
 	if (free != grp->bb_free) {
 		ext4_grp_locked_error(sb, group, 0, 0,
-				      "%u clusters in bitmap, %u in gd; "
-				      "block bitmap corrupt.",
+				      "block bitmap and bg descriptor "
+				      "inconsistent: %u vs %u free clusters",
 				      free, grp->bb_free);
 		/*
 		 * If we intend to continue, we consider group descriptor
-- 
2.0.0


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

* [PATCH 3.12 159/170] ext4: disable synchronous transaction batching if max_batch_time==0
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (157 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 158/170] ext4: clarify ext4_error message in ext4_mb_generate_buddy_error() Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 160/170] ext4: fix a potential deadlock in __ext4_es_shrink() Jiri Slaby
                   ` (11 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Eric Sandeen, Theodore Ts'o, Jiri Slaby

From: Eric Sandeen <sandeen@redhat.com>

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

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

commit 5dd214248f94d430d70e9230bda72f2654ac88a8 upstream.

The mount manpage says of the max_batch_time option,

	This optimization can be turned off entirely
	by setting max_batch_time to 0.

But the code doesn't do that.  So fix the code to do
that.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/ext4/super.c       | 2 --
 fs/jbd2/transaction.c | 5 ++++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index a8b886851ff6..9afc4ba21611 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1500,8 +1500,6 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
 			arg = JBD2_DEFAULT_MAX_COMMIT_AGE;
 		sbi->s_commit_interval = HZ * arg;
 	} else if (token == Opt_max_batch_time) {
-		if (arg == 0)
-			arg = EXT4_DEF_MAX_BATCH_TIME;
 		sbi->s_max_batch_time = arg;
 	} else if (token == Opt_min_batch_time) {
 		sbi->s_min_batch_time = arg;
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 7272cc6977ec..ab3815c856dc 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -1590,9 +1590,12 @@ int jbd2_journal_stop(handle_t *handle)
 	 * to perform a synchronous write.  We do this to detect the
 	 * case where a single process is doing a stream of sync
 	 * writes.  No point in waiting for joiners in that case.
+	 *
+	 * Setting max_batch_time to 0 disables this completely.
 	 */
 	pid = current->pid;
-	if (handle->h_sync && journal->j_last_sync_writer != pid) {
+	if (handle->h_sync && journal->j_last_sync_writer != pid &&
+	    journal->j_max_batch_time) {
 		u64 commit_time, trans_time;
 
 		journal->j_last_sync_writer = pid;
-- 
2.0.0


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

* [PATCH 3.12 160/170] ext4: fix a potential deadlock in __ext4_es_shrink()
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (158 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 159/170] ext4: disable synchronous transaction batching if max_batch_time==0 Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 161/170] drm/radeon/dpm: Reenabling SS on Cayman Jiri Slaby
                   ` (10 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Theodore Ts'o, Zheng Liu, Jiri Slaby

From: Theodore Ts'o <tytso@mit.edu>

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

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

commit 3f1f9b851311a76226140b55b1ea22111234a7c2 upstream.

This fixes the following lockdep complaint:

[ INFO: possible circular locking dependency detected ]
3.16.0-rc2-mm1+ #7 Tainted: G           O
-------------------------------------------------------
kworker/u24:0/4356 is trying to acquire lock:
 (&(&sbi->s_es_lru_lock)->rlock){+.+.-.}, at: [<ffffffff81285fff>] __ext4_es_shrink+0x4f/0x2e0

but task is already holding lock:
 (&ei->i_es_lock){++++-.}, at: [<ffffffff81286961>] ext4_es_insert_extent+0x71/0x180

which lock already depends on the new lock.

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&ei->i_es_lock);
                               lock(&(&sbi->s_es_lru_lock)->rlock);
                               lock(&ei->i_es_lock);
  lock(&(&sbi->s_es_lru_lock)->rlock);

 *** DEADLOCK ***

6 locks held by kworker/u24:0/4356:
 #0:  ("writeback"){.+.+.+}, at: [<ffffffff81071d00>] process_one_work+0x180/0x560
 #1:  ((&(&wb->dwork)->work)){+.+.+.}, at: [<ffffffff81071d00>] process_one_work+0x180/0x560
 #2:  (&type->s_umount_key#22){++++++}, at: [<ffffffff811a9c74>] grab_super_passive+0x44/0x90
 #3:  (jbd2_handle){+.+...}, at: [<ffffffff812979f9>] start_this_handle+0x189/0x5f0
 #4:  (&ei->i_data_sem){++++..}, at: [<ffffffff81247062>] ext4_map_blocks+0x132/0x550
 #5:  (&ei->i_es_lock){++++-.}, at: [<ffffffff81286961>] ext4_es_insert_extent+0x71/0x180

stack backtrace:
CPU: 0 PID: 4356 Comm: kworker/u24:0 Tainted: G           O   3.16.0-rc2-mm1+ #7
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
Workqueue: writeback bdi_writeback_workfn (flush-253:0)
 ffffffff8213dce0 ffff880014b07538 ffffffff815df0bb 0000000000000007
 ffffffff8213e040 ffff880014b07588 ffffffff815db3dd ffff880014b07568
 ffff880014b07610 ffff88003b868930 ffff88003b868908 ffff88003b868930
Call Trace:
 [<ffffffff815df0bb>] dump_stack+0x4e/0x68
 [<ffffffff815db3dd>] print_circular_bug+0x1fb/0x20c
 [<ffffffff810a7a3e>] __lock_acquire+0x163e/0x1d00
 [<ffffffff815e89dc>] ? retint_restore_args+0xe/0xe
 [<ffffffff815ddc7b>] ? __slab_alloc+0x4a8/0x4ce
 [<ffffffff81285fff>] ? __ext4_es_shrink+0x4f/0x2e0
 [<ffffffff810a8707>] lock_acquire+0x87/0x120
 [<ffffffff81285fff>] ? __ext4_es_shrink+0x4f/0x2e0
 [<ffffffff8128592d>] ? ext4_es_free_extent+0x5d/0x70
 [<ffffffff815e6f09>] _raw_spin_lock+0x39/0x50
 [<ffffffff81285fff>] ? __ext4_es_shrink+0x4f/0x2e0
 [<ffffffff8119760b>] ? kmem_cache_alloc+0x18b/0x1a0
 [<ffffffff81285fff>] __ext4_es_shrink+0x4f/0x2e0
 [<ffffffff812869b8>] ext4_es_insert_extent+0xc8/0x180
 [<ffffffff812470f4>] ext4_map_blocks+0x1c4/0x550
 [<ffffffff8124c4c4>] ext4_writepages+0x6d4/0xd00
	...

Reported-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reported-by: Minchan Kim <minchan@kernel.org>
Cc: Zheng Liu <gnehzuil.liu@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/ext4/extents_status.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c
index 3981ff783950..171b9fa0f27a 100644
--- a/fs/ext4/extents_status.c
+++ b/fs/ext4/extents_status.c
@@ -962,10 +962,10 @@ retry:
 			continue;
 		}
 
-		if (ei->i_es_lru_nr == 0 || ei == locked_ei)
+		if (ei->i_es_lru_nr == 0 || ei == locked_ei ||
+		    !write_trylock(&ei->i_es_lock))
 			continue;
 
-		write_lock(&ei->i_es_lock);
 		shrunk = __es_try_to_reclaim_extents(ei, nr_to_scan);
 		if (ei->i_es_lru_nr == 0)
 			list_del_init(&ei->i_es_lru);
-- 
2.0.0


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

* [PATCH 3.12 161/170] drm/radeon/dpm: Reenabling SS on Cayman
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (159 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 160/170] ext4: fix a potential deadlock in __ext4_es_shrink() Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 162/170] drm/radeon: fix typo in ci_stop_dpm() Jiri Slaby
                   ` (9 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alexandre Demers, Alex Deucher, Jiri Slaby

From: Alexandre Demers <alexandre.f.demers@gmail.com>

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

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

commit 41959341ac7e33dd360c7a881d13566f9eca37b2 upstream.

It reverts commit c745fe611ca42295c9d91d8e305d27983e9132ef now that
Cayman is stable since VDDCI fix. Spread spectrum was not the culprit.

This depends on b0880e87c1fd038b84498944f52e52c3e86ebe59
(drm/radeon/dpm: fix vddci setup typo on cayman).

Signed-off-by: Alexandre Demers <alexandre.f.demers@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/rv770_dpm.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c
index a239b30aaf9d..890cf1710253 100644
--- a/drivers/gpu/drm/radeon/rv770_dpm.c
+++ b/drivers/gpu/drm/radeon/rv770_dpm.c
@@ -2328,12 +2328,6 @@ void rv770_get_engine_memory_ss(struct radeon_device *rdev)
 	pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss,
 						       ASIC_INTERNAL_MEMORY_SS, 0);
 
-	/* disable ss, causes hangs on some cayman boards */
-	if (rdev->family == CHIP_CAYMAN) {
-		pi->sclk_ss = false;
-		pi->mclk_ss = false;
-	}
-
 	if (pi->sclk_ss || pi->mclk_ss)
 		pi->dynamic_ss = true;
 	else
-- 
2.0.0


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

* [PATCH 3.12 162/170] drm/radeon: fix typo in ci_stop_dpm()
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (160 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 161/170] drm/radeon/dpm: Reenabling SS on Cayman Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 163/170] drm/radeon: fix typo in golden register setup on evergreen Jiri Slaby
                   ` (8 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 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 ed96377132e564d797c48a5490fd46bed01c4273 upstream.

Need to use the RREG32_SMC() accessor since the register
is an smc indirect index.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/ci_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c
index 79682ff51b63..78e25d2e2fc4 100644
--- a/drivers/gpu/drm/radeon/ci_dpm.c
+++ b/drivers/gpu/drm/radeon/ci_dpm.c
@@ -1130,7 +1130,7 @@ static int ci_stop_dpm(struct radeon_device *rdev)
 	tmp &= ~GLOBAL_PWRMGT_EN;
 	WREG32_SMC(GENERAL_PWRMGT, tmp);
 
-	tmp = RREG32(SCLK_PWRMGT_CNTL);
+	tmp = RREG32_SMC(SCLK_PWRMGT_CNTL);
 	tmp &= ~DYNAMIC_PM_EN;
 	WREG32_SMC(SCLK_PWRMGT_CNTL, tmp);
 
-- 
2.0.0


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

* [PATCH 3.12 163/170] drm/radeon: fix typo in golden register setup on evergreen
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (161 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 162/170] drm/radeon: fix typo in ci_stop_dpm() Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 164/170] drm/radeon: stop poisoning the GART TLB Jiri Slaby
                   ` (7 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 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 6abafb78f9881b4891baf74ab4e9f090ae45230e upstream.

Fixes hangs on driver load on some cards.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=76998

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/evergreen.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index e1b2470d3443..4564bb1ab837 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -188,7 +188,7 @@ static const u32 evergreen_golden_registers[] =
 	0x8c1c, 0xffffffff, 0x00001010,
 	0x28350, 0xffffffff, 0x00000000,
 	0xa008, 0xffffffff, 0x00010000,
-	0x5cc, 0xffffffff, 0x00000001,
+	0x5c4, 0xffffffff, 0x00000001,
 	0x9508, 0xffffffff, 0x00000002,
 	0x913c, 0x0000000f, 0x0000000a
 };
@@ -475,7 +475,7 @@ static const u32 cedar_golden_registers[] =
 	0x8c1c, 0xffffffff, 0x00001010,
 	0x28350, 0xffffffff, 0x00000000,
 	0xa008, 0xffffffff, 0x00010000,
-	0x5cc, 0xffffffff, 0x00000001,
+	0x5c4, 0xffffffff, 0x00000001,
 	0x9508, 0xffffffff, 0x00000002
 };
 
@@ -634,7 +634,7 @@ static const u32 juniper_mgcg_init[] =
 static const u32 supersumo_golden_registers[] =
 {
 	0x5eb4, 0xffffffff, 0x00000002,
-	0x5cc, 0xffffffff, 0x00000001,
+	0x5c4, 0xffffffff, 0x00000001,
 	0x7030, 0xffffffff, 0x00000011,
 	0x7c30, 0xffffffff, 0x00000011,
 	0x6104, 0x01000300, 0x00000000,
@@ -718,7 +718,7 @@ static const u32 sumo_golden_registers[] =
 static const u32 wrestler_golden_registers[] =
 {
 	0x5eb4, 0xffffffff, 0x00000002,
-	0x5cc, 0xffffffff, 0x00000001,
+	0x5c4, 0xffffffff, 0x00000001,
 	0x7030, 0xffffffff, 0x00000011,
 	0x7c30, 0xffffffff, 0x00000011,
 	0x6104, 0x01000300, 0x00000000,
-- 
2.0.0


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

* [PATCH 3.12 164/170] drm/radeon: stop poisoning the GART TLB
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (162 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 163/170] drm/radeon: fix typo in golden register setup on evergreen Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 165/170] drm/i915: Don't clobber the GTT when it's within stolen memory Jiri Slaby
                   ` (6 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 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 0986c1a55ca64b44ee126a2f719a6e9f28cbe0ed upstream.

When we set the valid bit on invalid GART entries they are
loaded into the TLB when an adjacent entry is loaded. This
poisons the TLB with invalid entries which are sometimes
not correctly removed on TLB flush.

For stable inclusion the patch probably needs to be modified a bit.

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/rs600.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index 6acba8017b9a..e0daa4fdb073 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -582,8 +582,10 @@ int rs600_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr)
 		return -EINVAL;
 	}
 	addr = addr & 0xFFFFFFFFFFFFF000ULL;
-	addr |= R600_PTE_VALID | R600_PTE_SYSTEM | R600_PTE_SNOOPED;
-	addr |= R600_PTE_READABLE | R600_PTE_WRITEABLE;
+	if (addr != rdev->dummy_page.addr)
+		addr |= R600_PTE_VALID | R600_PTE_READABLE |
+			R600_PTE_WRITEABLE;
+	addr |= R600_PTE_SYSTEM | R600_PTE_SNOOPED;
 	writeq(addr, ptr + (i * 8));
 	return 0;
 }
-- 
2.0.0


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

* [PATCH 3.12 165/170] drm/i915: Don't clobber the GTT when it's within stolen memory
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (163 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 164/170] drm/radeon: stop poisoning the GART TLB Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 166/170] DMA, CMA: fix possible memory leak Jiri Slaby
                   ` (5 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ville Syrjälä, Daniel Vetter, Jiri Slaby

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

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

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

commit f1e1c2129b79cfdaf07bca37c5a10569fe021abe upstream.

On most gen2-4 platforms the GTT can be (or maybe always is?)
inside the stolen memory region. If that's the case, reduce the
size of the stolen memory appropriately to make make sure we
don't clobber the GTT.

v2: Deal with gen4 36 bit physical address

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80151
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 44 ++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_reg.h        |  3 +++
 2 files changed, 47 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index c60cdf9e581e..5cd69a7cc241 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -74,6 +74,50 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
 	if (base == 0)
 		return 0;
 
+	/* make sure we don't clobber the GTT if it's within stolen memory */
+	if (INTEL_INFO(dev)->gen <= 4 && !IS_G33(dev) && !IS_G4X(dev)) {
+		struct {
+			u32 start, end;
+		} stolen[2] = {
+			{ .start = base, .end = base + dev_priv->gtt.stolen_size, },
+			{ .start = base, .end = base + dev_priv->gtt.stolen_size, },
+		};
+		u64 gtt_start, gtt_end;
+
+		gtt_start = I915_READ(PGTBL_CTL);
+		if (IS_GEN4(dev))
+			gtt_start = (gtt_start & PGTBL_ADDRESS_LO_MASK) |
+				(gtt_start & PGTBL_ADDRESS_HI_MASK) << 28;
+		else
+			gtt_start &= PGTBL_ADDRESS_LO_MASK;
+		gtt_end = gtt_start + gtt_total_entries(dev_priv->gtt) * 4;
+
+		if (gtt_start >= stolen[0].start && gtt_start < stolen[0].end)
+			stolen[0].end = gtt_start;
+		if (gtt_end > stolen[1].start && gtt_end <= stolen[1].end)
+			stolen[1].start = gtt_end;
+
+		/* pick the larger of the two chunks */
+		if (stolen[0].end - stolen[0].start >
+		    stolen[1].end - stolen[1].start) {
+			base = stolen[0].start;
+			dev_priv->gtt.stolen_size = stolen[0].end - stolen[0].start;
+		} else {
+			base = stolen[1].start;
+			dev_priv->gtt.stolen_size = stolen[1].end - stolen[1].start;
+		}
+
+		if (stolen[0].start != stolen[1].start ||
+		    stolen[0].end != stolen[1].end) {
+			DRM_DEBUG_KMS("GTT within stolen memory at 0x%llx-0x%llx\n",
+				      (unsigned long long) gtt_start,
+				      (unsigned long long) gtt_end - 1);
+			DRM_DEBUG_KMS("Stolen memory adjusted to 0x%x-0x%x\n",
+				      base, base + (u32) dev_priv->gtt.stolen_size - 1);
+		}
+	}
+
+
 	/* Verify that nothing else uses this physical address. Stolen
 	 * memory should be reserved by the BIOS and hidden from the
 	 * kernel. So if the region is already marked as busy, something
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 375abe708268..998f774b5fff 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -570,6 +570,9 @@
 /*
  * Instruction and interrupt control regs
  */
+#define PGTBL_CTL	0x02020
+#define   PGTBL_ADDRESS_LO_MASK	0xfffff000 /* bits [31:12] */
+#define   PGTBL_ADDRESS_HI_MASK	0x000000f0 /* bits [35:32] (gen4) */
 #define PGTBL_ER	0x02024
 #define RENDER_RING_BASE	0x02000
 #define BSD_RING_BASE		0x04000
-- 
2.0.0


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

* [PATCH 3.12 166/170] DMA, CMA: fix possible memory leak
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (164 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 165/170] drm/i915: Don't clobber the GTT when it's within stolen memory Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 167/170] ring-buffer: Check if buffer exists before polling Jiri Slaby
                   ` (4 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Joonsoo Kim, Aneesh Kumar K.V, Marek Szyprowski,
	Michal Nazarewicz, Paolo Bonzini, Gleb Natapov, Alexander Graf,
	Benjamin Herrenschmidt, Paul Mackerras, 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 fe8eea4f4a3f299ef83ed090d5354698ebe4fda8 upstream.

We should free memory for bitmap when we find zone mismatch, otherwise
this memory will leak.

Additionally, I copy code comment from PPC KVM's CMA code to inform why
we need to check zone mis-match.

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Acked-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Reviewed-by: Michal Nazarewicz <mina86@mina86.com>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: Alexander Graf <agraf@suse.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.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>
---
 drivers/base/dma-contiguous.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c
index 99802d6f3c60..e057744150ea 100644
--- a/drivers/base/dma-contiguous.c
+++ b/drivers/base/dma-contiguous.c
@@ -155,13 +155,23 @@ static int __init cma_activate_area(struct cma *cma)
 		base_pfn = pfn;
 		for (j = pageblock_nr_pages; j; --j, pfn++) {
 			WARN_ON_ONCE(!pfn_valid(pfn));
+			/*
+			 * alloc_contig_range requires the pfn range
+			 * specified to be in the same zone. Make this
+			 * simple by forcing the entire CMA resv range
+			 * to be in the same zone.
+			 */
 			if (page_zone(pfn_to_page(pfn)) != zone)
-				return -EINVAL;
+				goto err;
 		}
 		init_cma_reserved_pageblock(pfn_to_page(base_pfn));
 	} while (--i);
 
 	return 0;
+
+err:
+	kfree(cma->bitmap);
+	return -EINVAL;
 }
 
 static struct cma cma_areas[MAX_CMA_AREAS];
-- 
2.0.0


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

* [PATCH 3.12 167/170] ring-buffer: Check if buffer exists before polling
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (165 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 166/170] DMA, CMA: fix possible memory leak Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 168/170] powerpc: Disable RELOCATABLE for COMPILE_TEST with PPC64 Jiri Slaby
                   ` (3 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Steven Rostedt (Red Hat), Jiri Slaby

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

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

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

commit 8b8b36834d0fff67fc8668093f4312dd04dcf21d upstream.

The per_cpu buffers are created one per possible CPU. But these do
not mean that those CPUs are online, nor do they even exist.

With the addition of the ring buffer polling, it assumes that the
caller polls on an existing buffer. But this is not the case if
the user reads trace_pipe from a CPU that does not exist, and this
causes the kernel to crash.

Simple fix is to check the cpu against buffer bitmask against to see
if the buffer was allocated or not and return -ENODEV if it is
not.

More updates were done to pass the -ENODEV back up to userspace.

Link: http://lkml.kernel.org/r/5393DB61.6060707@oracle.com

Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 include/linux/ring_buffer.h |  2 +-
 kernel/trace/ring_buffer.c  |  5 ++++-
 kernel/trace/trace.c        | 25 ++++++++++++++++++-------
 kernel/trace/trace.h        |  4 ++--
 4 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index d69cf637a15a..49a4d6f59108 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -97,7 +97,7 @@ __ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *k
 	__ring_buffer_alloc((size), (flags), &__key);	\
 })
 
-void ring_buffer_wait(struct ring_buffer *buffer, int cpu);
+int ring_buffer_wait(struct ring_buffer *buffer, int cpu);
 int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu,
 			  struct file *filp, poll_table *poll_table);
 
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 0e337eedb909..15c4ae203885 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -543,7 +543,7 @@ static void rb_wake_up_waiters(struct irq_work *work)
  * as data is added to any of the @buffer's cpu buffers. Otherwise
  * it will wait for data to be added to a specific cpu buffer.
  */
-void ring_buffer_wait(struct ring_buffer *buffer, int cpu)
+int ring_buffer_wait(struct ring_buffer *buffer, int cpu)
 {
 	struct ring_buffer_per_cpu *cpu_buffer;
 	DEFINE_WAIT(wait);
@@ -557,6 +557,8 @@ void ring_buffer_wait(struct ring_buffer *buffer, int cpu)
 	if (cpu == RING_BUFFER_ALL_CPUS)
 		work = &buffer->irq_work;
 	else {
+		if (!cpumask_test_cpu(cpu, buffer->cpumask))
+			return -ENODEV;
 		cpu_buffer = buffer->buffers[cpu];
 		work = &cpu_buffer->irq_work;
 	}
@@ -591,6 +593,7 @@ void ring_buffer_wait(struct ring_buffer *buffer, int cpu)
 		schedule();
 
 	finish_wait(&work->waiters, &wait);
+	return 0;
 }
 
 /**
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 57d7c64bb980..5e9cb157d31e 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1044,13 +1044,13 @@ update_max_tr_single(struct trace_array *tr, struct task_struct *tsk, int cpu)
 }
 #endif /* CONFIG_TRACER_MAX_TRACE */
 
-static void default_wait_pipe(struct trace_iterator *iter)
+static int default_wait_pipe(struct trace_iterator *iter)
 {
 	/* Iterators are static, they should be filled or empty */
 	if (trace_buffer_iter(iter, iter->cpu_file))
-		return;
+		return 0;
 
-	ring_buffer_wait(iter->trace_buffer->buffer, iter->cpu_file);
+	return ring_buffer_wait(iter->trace_buffer->buffer, iter->cpu_file);
 }
 
 #ifdef CONFIG_FTRACE_STARTUP_TEST
@@ -4059,17 +4059,19 @@ tracing_poll_pipe(struct file *filp, poll_table *poll_table)
  *
  *     Anyway, this is really very primitive wakeup.
  */
-void poll_wait_pipe(struct trace_iterator *iter)
+int poll_wait_pipe(struct trace_iterator *iter)
 {
 	set_current_state(TASK_INTERRUPTIBLE);
 	/* sleep for 100 msecs, and try again. */
 	schedule_timeout(HZ / 10);
+	return 0;
 }
 
 /* Must be called with trace_types_lock mutex held. */
 static int tracing_wait_pipe(struct file *filp)
 {
 	struct trace_iterator *iter = filp->private_data;
+	int ret;
 
 	while (trace_empty(iter)) {
 
@@ -4079,10 +4081,13 @@ static int tracing_wait_pipe(struct file *filp)
 
 		mutex_unlock(&iter->mutex);
 
-		iter->trace->wait_pipe(iter);
+		ret = iter->trace->wait_pipe(iter);
 
 		mutex_lock(&iter->mutex);
 
+		if (ret)
+			return ret;
+
 		if (signal_pending(current))
 			return -EINTR;
 
@@ -5016,8 +5021,12 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,
 				goto out_unlock;
 			}
 			mutex_unlock(&trace_types_lock);
-			iter->trace->wait_pipe(iter);
+			ret = iter->trace->wait_pipe(iter);
 			mutex_lock(&trace_types_lock);
+			if (ret) {
+				size = ret;
+				goto out_unlock;
+			}
 			if (signal_pending(current)) {
 				size = -EINTR;
 				goto out_unlock;
@@ -5229,8 +5238,10 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
 			goto out;
 		}
 		mutex_unlock(&trace_types_lock);
-		iter->trace->wait_pipe(iter);
+		ret = iter->trace->wait_pipe(iter);
 		mutex_lock(&trace_types_lock);
+		if (ret)
+			goto out;
 		if (signal_pending(current)) {
 			ret = -EINTR;
 			goto out;
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 10c86fb7a2b4..7e8be3e50f83 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -334,7 +334,7 @@ struct tracer {
 	void			(*stop)(struct trace_array *tr);
 	void			(*open)(struct trace_iterator *iter);
 	void			(*pipe_open)(struct trace_iterator *iter);
-	void			(*wait_pipe)(struct trace_iterator *iter);
+	int			(*wait_pipe)(struct trace_iterator *iter);
 	void			(*close)(struct trace_iterator *iter);
 	void			(*pipe_close)(struct trace_iterator *iter);
 	ssize_t			(*read)(struct trace_iterator *iter,
@@ -549,7 +549,7 @@ void trace_init_global_iter(struct trace_iterator *iter);
 
 void tracing_iter_reset(struct trace_iterator *iter, int cpu);
 
-void poll_wait_pipe(struct trace_iterator *iter);
+int poll_wait_pipe(struct trace_iterator *iter);
 
 void tracing_sched_switch_trace(struct trace_array *tr,
 				struct task_struct *prev,
-- 
2.0.0


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

* [PATCH 3.12 168/170] powerpc: Disable RELOCATABLE for COMPILE_TEST with PPC64
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (166 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 167/170] ring-buffer: Check if buffer exists before polling Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 169/170] x86, ioremap: Speed up check for RAM pages Jiri Slaby
                   ` (2 subsequent siblings)
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Guenter Roeck, Benjamin Herrenschmidt, Jiri Slaby

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

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

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

commit fb43e8477ed9006c4f397f904c691a120503038c upstream.

powerpc:allmodconfig has been failing for some time with the following
error.

arch/powerpc/kernel/exceptions-64s.S: Assembler messages:
arch/powerpc/kernel/exceptions-64s.S:1312: Error: attempt to move .org backwards
make[1]: *** [arch/powerpc/kernel/head_64.o] Error 1

A number of attempts to fix the problem by moving around code have been
unsuccessful and resulted in failed builds for some configurations and
the discovery of toolchain bugs.

Fix the problem by disabling RELOCATABLE for COMPILE_TEST builds instead.
While this is less than perfect, it avoids substantial code changes
which would otherwise be necessary just to make COMPILE_TEST builds
happy and might have undesired side effects.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 38f3b7e47ec5..d5d026b6d237 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -395,7 +395,7 @@ config KEXEC
 config CRASH_DUMP
 	bool "Build a kdump crash kernel"
 	depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP)
-	select RELOCATABLE if PPC64 || 44x
+	select RELOCATABLE if (PPC64 && !COMPILE_TEST) || 44x
 	select DYNAMIC_MEMSTART if FSL_BOOKE
 	help
 	  Build a kernel suitable for use as a kdump capture kernel.
@@ -985,6 +985,7 @@ endmenu
 if PPC64
 config RELOCATABLE
 	bool "Build a relocatable kernel"
+	depends on !COMPILE_TEST
 	select NONSTATIC_KERNEL
 	help
 	  This builds a kernel image that is capable of running anywhere
-- 
2.0.0


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

* [PATCH 3.12 169/170] x86, ioremap: Speed up check for RAM pages
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (167 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 168/170] powerpc: Disable RELOCATABLE for COMPILE_TEST with PPC64 Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:12 ` [PATCH 3.12 170/170] ACPI / battery: Retry to get battery information if failed during probing Jiri Slaby
  2014-07-18 12:16 ` [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Roland Dreier, H. Peter Anvin, Jiri Slaby

From: Roland Dreier <roland@purestorage.com>

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

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

commit c81c8a1eeede61e92a15103748c23d100880cc8a upstream.

In __ioremap_caller() (the guts of ioremap), we loop over the range of
pfns being remapped and checks each one individually with page_is_ram().
For large ioremaps, this can be very slow.  For example, we have a
device with a 256 GiB PCI BAR, and ioremapping this BAR can take 20+
seconds -- sometimes long enough to trigger the soft lockup detector!

Internally, page_is_ram() calls walk_system_ram_range() on a single
page.  Instead, we can make a single call to walk_system_ram_range()
from __ioremap_caller(), and do our further checks only for any RAM
pages that we find.  For the common case of MMIO, this saves an enormous
amount of work, since the range being ioremapped doesn't intersect
system RAM at all.

With this change, ioremap on our 256 GiB BAR takes less than 1 second.

Signed-off-by: Roland Dreier <roland@purestorage.com>
Link: http://lkml.kernel.org/r/1399054721-1331-1-git-send-email-roland@kernel.org
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/mm/ioremap.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 799580cabc78..94bd24771812 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -50,6 +50,21 @@ int ioremap_change_attr(unsigned long vaddr, unsigned long size,
 	return err;
 }
 
+static int __ioremap_check_ram(unsigned long start_pfn, unsigned long nr_pages,
+			       void *arg)
+{
+	unsigned long i;
+
+	for (i = 0; i < nr_pages; ++i)
+		if (pfn_valid(start_pfn + i) &&
+		    !PageReserved(pfn_to_page(start_pfn + i)))
+			return 1;
+
+	WARN_ONCE(1, "ioremap on RAM pfn 0x%lx\n", start_pfn);
+
+	return 0;
+}
+
 /*
  * Remap an arbitrary physical address space into the kernel virtual
  * address space. Needed when the kernel wants to access high addresses
@@ -93,14 +108,11 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
 	/*
 	 * Don't allow anybody to remap normal RAM that we're using..
 	 */
+	pfn      = phys_addr >> PAGE_SHIFT;
 	last_pfn = last_addr >> PAGE_SHIFT;
-	for (pfn = phys_addr >> PAGE_SHIFT; pfn <= last_pfn; pfn++) {
-		int is_ram = page_is_ram(pfn);
-
-		if (is_ram && pfn_valid(pfn) && !PageReserved(pfn_to_page(pfn)))
-			return NULL;
-		WARN_ON_ONCE(is_ram);
-	}
+	if (walk_system_ram_range(pfn, last_pfn - pfn + 1, NULL,
+				  __ioremap_check_ram) == 1)
+		return NULL;
 
 	/*
 	 * Mappings have to be page-aligned
-- 
2.0.0


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

* [PATCH 3.12 170/170] ACPI / battery: Retry to get battery information if failed during probing
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (168 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 169/170] x86, ioremap: Speed up check for RAM pages Jiri Slaby
@ 2014-07-18 12:12 ` Jiri Slaby
  2014-07-18 12:16 ` [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
  170 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:12 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Lan Tianyu, Rafael J. Wysocki, Jiri Slaby

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

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

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

commit 75646e758a0ecbed5024454507d5be5b9ea9dcbf upstream.

Some machines (eg. Lenovo Z480) ECs are not stable during boot up
and causes battery driver fails to be loaded due to failure of getting
battery information from EC sometimes. After several retries, the
operation will work. This patch is to retry to get battery information 5
times if the first try fails.

[ backport to 3.14.5: removed second parameter in acpi_battery_update(),
introduced by the commit 9e50bc14a7f58b5d8a55973b2d69355852ae2dae (ACPI /
battery: Accelerate battery resume callback)]

[naszar <naszar@ya.ru>: backport to 3.14.5]
Link: https://bugzilla.kernel.org/show_bug.cgi?id=75581
Reported-and-tested-by: naszar <naszar@ya.ru>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/acpi/battery.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index ffa5af4c221a..a59d3d3fbcdc 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -34,6 +34,7 @@
 #include <linux/dmi.h>
 #include <linux/slab.h>
 #include <linux/suspend.h>
+#include <linux/delay.h>
 #include <asm/unaligned.h>
 
 #ifdef CONFIG_ACPI_PROCFS_POWER
@@ -1071,6 +1072,28 @@ static struct dmi_system_id bat_dmi_table[] = {
 	{},
 };
 
+/*
+ * Some machines'(E,G Lenovo Z480) ECs are not stable
+ * during boot up and this causes battery driver fails to be
+ * probed due to failure of getting battery information
+ * from EC sometimes. After several retries, the operation
+ * may work. So add retry code here and 20ms sleep between
+ * every retries.
+ */
+static int acpi_battery_update_retry(struct acpi_battery *battery)
+{
+	int retry, ret;
+
+	for (retry = 5; retry; retry--) {
+		ret = acpi_battery_update(battery);
+		if (!ret)
+			break;
+
+		msleep(20);
+	}
+	return ret;
+}
+
 static int acpi_battery_add(struct acpi_device *device)
 {
 	int result = 0;
@@ -1089,9 +1112,11 @@ static int acpi_battery_add(struct acpi_device *device)
 	mutex_init(&battery->sysfs_lock);
 	if (acpi_has_method(battery->device->handle, "_BIX"))
 		set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags);
-	result = acpi_battery_update(battery);
+
+	result = acpi_battery_update_retry(battery);
 	if (result)
 		goto fail;
+
 #ifdef CONFIG_ACPI_PROCFS_POWER
 	result = acpi_battery_add_fs(device);
 #endif
-- 
2.0.0


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

* Re: [PATCH 3.12 000/170] 3.12.25-stable review
  2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
                   ` (169 preceding siblings ...)
  2014-07-18 12:12 ` [PATCH 3.12 170/170] ACPI / battery: Retry to get battery information if failed during probing Jiri Slaby
@ 2014-07-18 12:16 ` Jiri Slaby
  2014-07-18 13:47   ` Guenter Roeck
  2014-07-21 15:31   ` Shuah Khan
  170 siblings, 2 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-18 12:16 UTC (permalink / raw)
  To: stable; +Cc: linux, satoru.takeuchi, shuah.kh, linux-kernel

On 07/18/2014 02:12 PM, Jiri Slaby wrote:
> This is the start of the stable review cycle for the 3.12.25 release.
> There are 170 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 Sun Jul 20 12:11:21 2014

Oh, this should have been two *workdays*, i.e. the deadline is Jul 22.

-- 
js
suse labs

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

* Re: [PATCH 3.12 000/170] 3.12.25-stable review
  2014-07-18 12:16 ` [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
@ 2014-07-18 13:47   ` Guenter Roeck
  2014-07-19  2:38     ` Satoru Takeuchi
  2014-07-21 15:31   ` Shuah Khan
  1 sibling, 1 reply; 178+ messages in thread
From: Guenter Roeck @ 2014-07-18 13:47 UTC (permalink / raw)
  To: Jiri Slaby, stable; +Cc: satoru.takeuchi, shuah.kh, linux-kernel

On 07/18/2014 05:16 AM, Jiri Slaby wrote:
> On 07/18/2014 02:12 PM, Jiri Slaby wrote:
>> This is the start of the stable review cycle for the 3.12.25 release.
>> There are 170 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 Sun Jul 20 12:11:21 2014
>
> Oh, this should have been two *workdays*, i.e. the deadline is Jul 22.
>

Build results:
	total: 137 pass: 137 fail: 0

Qemu tests all passed.

Details are available at http://server.roeck-us.net:8010/builders.

Guenter


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

* Re: [PATCH 3.12 100/170] hugetlb: fix copy_hugetlb_page_range() to handle migration/hwpoisoned entry
  2014-07-18 12:11 ` [PATCH 3.12 100/170] hugetlb: fix copy_hugetlb_page_range() to handle migration/hwpoisoned entry Jiri Slaby
@ 2014-07-18 18:53   ` Hugh Dickins
  2014-07-20 19:51     ` Jiri Slaby
  0 siblings, 1 reply; 178+ messages in thread
From: Hugh Dickins @ 2014-07-18 18:53 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: stable, linux-kernel, Naoya Horiguchi, Christoph Lameter,
	Andrew Morton, Linus Torvalds

On Fri, 18 Jul 2014, Jiri Slaby wrote:

> From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> 
> 3.12-stable review patch.  If anyone has any objections, please let me know.
> 
> ===============
> 
> commit 4a705fef986231a3e7a6b1a6d3c37025f021f49f upstream.
> 
> There's a race between fork() and hugepage migration, as a result we try
> to "dereference" a swap entry as a normal pte, causing kernel panic.
> The cause of the problem is that copy_hugetlb_page_range() can't handle
> "swap entry" family (migration entry and hwpoisoned entry) so let's fix
> it.
> 
> [akpm@linux-foundation.org: coding-style fixes]
> Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Acked-by: Hugh Dickins <hughd@google.com>
> Cc: Christoph Lameter <cl@linux.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>

Please drop this one for now: other -stables have carried it, but it
was found yesterday to contain a bug of its own, arguably worse than
what it's fixing.  Naoya-san has done the fix for that, it's in mmotm
and should make its way to Linus probably next week: so please hold
this back until that can join it - thanks.

Hugh

> ---
>  mm/hugetlb.c | 71 ++++++++++++++++++++++++++++++++++++------------------------
>  1 file changed, 43 insertions(+), 28 deletions(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 92e103b72dcb..11c2b7fed052 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -2381,6 +2381,31 @@ static void set_huge_ptep_writable(struct vm_area_struct *vma,
>  		update_mmu_cache(vma, address, ptep);
>  }
>  
> +static int is_hugetlb_entry_migration(pte_t pte)
> +{
> +	swp_entry_t swp;
> +
> +	if (huge_pte_none(pte) || pte_present(pte))
> +		return 0;
> +	swp = pte_to_swp_entry(pte);
> +	if (non_swap_entry(swp) && is_migration_entry(swp))
> +		return 1;
> +	else
> +		return 0;
> +}
> +
> +static int is_hugetlb_entry_hwpoisoned(pte_t pte)
> +{
> +	swp_entry_t swp;
> +
> +	if (huge_pte_none(pte) || pte_present(pte))
> +		return 0;
> +	swp = pte_to_swp_entry(pte);
> +	if (non_swap_entry(swp) && is_hwpoison_entry(swp))
> +		return 1;
> +	else
> +		return 0;
> +}
>  
>  int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
>  			    struct vm_area_struct *vma)
> @@ -2408,10 +2433,26 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
>  
>  		spin_lock(&dst->page_table_lock);
>  		spin_lock_nested(&src->page_table_lock, SINGLE_DEPTH_NESTING);
> -		if (!huge_pte_none(huge_ptep_get(src_pte))) {
> +		entry = huge_ptep_get(src_pte);
> +		if (huge_pte_none(entry)) { /* skip none entry */
> +			;
> +		} else if (unlikely(is_hugetlb_entry_migration(entry) ||
> +				    is_hugetlb_entry_hwpoisoned(entry))) {
> +			swp_entry_t swp_entry = pte_to_swp_entry(entry);
> +
> +			if (is_write_migration_entry(swp_entry) && cow) {
> +				/*
> +				 * COW mappings require pages in both
> +				 * parent and child to be set to read.
> +				 */
> +				make_migration_entry_read(&swp_entry);
> +				entry = swp_entry_to_pte(swp_entry);
> +				set_huge_pte_at(src, addr, src_pte, entry);
> +			}
> +			set_huge_pte_at(dst, addr, dst_pte, entry);
> +		} else {
>  			if (cow)
>  				huge_ptep_set_wrprotect(src, addr, src_pte);
> -			entry = huge_ptep_get(src_pte);
>  			ptepage = pte_page(entry);
>  			get_page(ptepage);
>  			page_dup_rmap(ptepage);
> @@ -2426,32 +2467,6 @@ nomem:
>  	return -ENOMEM;
>  }
>  
> -static int is_hugetlb_entry_migration(pte_t pte)
> -{
> -	swp_entry_t swp;
> -
> -	if (huge_pte_none(pte) || pte_present(pte))
> -		return 0;
> -	swp = pte_to_swp_entry(pte);
> -	if (non_swap_entry(swp) && is_migration_entry(swp))
> -		return 1;
> -	else
> -		return 0;
> -}
> -
> -static int is_hugetlb_entry_hwpoisoned(pte_t pte)
> -{
> -	swp_entry_t swp;
> -
> -	if (huge_pte_none(pte) || pte_present(pte))
> -		return 0;
> -	swp = pte_to_swp_entry(pte);
> -	if (non_swap_entry(swp) && is_hwpoison_entry(swp))
> -		return 1;
> -	else
> -		return 0;
> -}
> -
>  void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
>  			    unsigned long start, unsigned long end,
>  			    struct page *ref_page)
> -- 
> 2.0.0

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

* Re: [PATCH 3.12 000/170] 3.12.25-stable review
  2014-07-18 13:47   ` Guenter Roeck
@ 2014-07-19  2:38     ` Satoru Takeuchi
  2014-07-22  9:02       ` Jiri Slaby
  0 siblings, 1 reply; 178+ messages in thread
From: Satoru Takeuchi @ 2014-07-19  2:38 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Jiri Slaby, stable, satoru.takeuchi, shuah.kh, linux-kernel

At Fri, 18 Jul 2014 06:47:32 -0700,
Guenter Roeck wrote:
> 
> On 07/18/2014 05:16 AM, Jiri Slaby wrote:
> > On 07/18/2014 02:12 PM, Jiri Slaby wrote:
> >> This is the start of the stable review cycle for the 3.12.25 release.
> >> There are 170 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 Sun Jul 20 12:11:21 2014
> > 
> > Oh, this should have been two *workdays*, i.e. the deadline is Jul 22.
> > 
> 
> Build results:
> 	total: 137 pass: 137 fail: 0
> 
> Qemu tests all passed.
> 
> Details are available at http://server.roeck-us.net:8010/builders.
> 
> Guenter
> 

Plus, it passed my test too.

 - Test Cases:
   - Build this kernel.
   - Boot this kernel.
   - Build the latest mainline kernel with this kernel.

 - Test Tool:
   https://github.com/satoru-takeuchi/test-linux-stable

 - Test Result (kernel .config, ktest config and test log):
   http://satoru-takeuchi.org/test-linux-stable/results/<version>-<test datetime>.tar.xz

 - Build Environment:
   - OS: Debian Jessy x86_64
   - CPU: Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz x 4
   - memory: 8GB

 - Test Target Environment:
   - Debian Jessy x86_64 (KVM guest on the Build Environment)
   - # of vCPU: 2
   - memory: 2GB

Thanks,
Satoru

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

* Re: [PATCH 3.12 100/170] hugetlb: fix copy_hugetlb_page_range() to handle migration/hwpoisoned entry
  2014-07-18 18:53   ` Hugh Dickins
@ 2014-07-20 19:51     ` Jiri Slaby
  0 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-20 19:51 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: stable, linux-kernel, Naoya Horiguchi, Christoph Lameter,
	Andrew Morton, Linus Torvalds

On 07/18/2014 08:53 PM, Hugh Dickins wrote:
> On Fri, 18 Jul 2014, Jiri Slaby wrote:
> 
>> From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
>>
>> 3.12-stable review patch.  If anyone has any objections, please let me know.
>>
>> ===============
>>
>> commit 4a705fef986231a3e7a6b1a6d3c37025f021f49f upstream.
>>
>> There's a race between fork() and hugepage migration, as a result we try
>> to "dereference" a swap entry as a normal pte, causing kernel panic.
>> The cause of the problem is that copy_hugetlb_page_range() can't handle
>> "swap entry" family (migration entry and hwpoisoned entry) so let's fix
>> it.
>>
>> [akpm@linux-foundation.org: coding-style fixes]
>> Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
>> Acked-by: Hugh Dickins <hughd@google.com>
>> Cc: Christoph Lameter <cl@linux.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>
> 
> Please drop this one for now: other -stables have carried it, but it
> was found yesterday to contain a bug of its own, arguably worse than
> what it's fixing.  Naoya-san has done the fix for that, it's in mmotm
> and should make its way to Linus probably next week: so please hold
> this back until that can join it - thanks.

Thanks, I dropped it later on Fri already after Guillaume informed me
about this.

-- 
js
suse labs

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

* Re: [PATCH 3.12 000/170] 3.12.25-stable review
  2014-07-18 12:16 ` [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
  2014-07-18 13:47   ` Guenter Roeck
@ 2014-07-21 15:31   ` Shuah Khan
  1 sibling, 0 replies; 178+ messages in thread
From: Shuah Khan @ 2014-07-21 15:31 UTC (permalink / raw)
  To: Jiri Slaby, stable; +Cc: linux, satoru.takeuchi, linux-kernel, Shuah Khan

On 07/18/2014 06:16 AM, Jiri Slaby wrote:
> On 07/18/2014 02:12 PM, Jiri Slaby wrote:
>> This is the start of the stable review cycle for the 3.12.25 release.
>> There are 170 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 Sun Jul 20 12:11:21 2014
>
> Oh, this should have been two *workdays*, i.e. the deadline is Jul 22.
>

Compiled and booted on my test system. No dmesg regressions.

-- Shuah

-- 
Shuah Khan
Senior Linux Kernel Developer - Open Source Group
Samsung Research America(Silicon Valley)
shuah.kh@samsung.com | (970) 672-0658

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

* Re: [PATCH 3.12 000/170] 3.12.25-stable review
  2014-07-19  2:38     ` Satoru Takeuchi
@ 2014-07-22  9:02       ` Jiri Slaby
  0 siblings, 0 replies; 178+ messages in thread
From: Jiri Slaby @ 2014-07-22  9:02 UTC (permalink / raw)
  To: Satoru Takeuchi, Guenter Roeck; +Cc: stable, shuah.kh, linux-kernel

On 07/19/2014 04:38 AM, Satoru Takeuchi wrote:
> At Fri, 18 Jul 2014 06:47:32 -0700,
> Guenter Roeck wrote:
>>
>> On 07/18/2014 05:16 AM, Jiri Slaby wrote:
>>> On 07/18/2014 02:12 PM, Jiri Slaby wrote:
>>>> This is the start of the stable review cycle for the 3.12.25 release.
>>>> There are 170 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 Sun Jul 20 12:11:21 2014
>>>
>>> Oh, this should have been two *workdays*, i.e. the deadline is Jul 22.
>>>
>>
>> Build results:
>> 	total: 137 pass: 137 fail: 0
>>
>> Qemu tests all passed.
>>
>> Details are available at http://server.roeck-us.net:8010/builders.
>>
>> Guenter
>>
> 
> Plus, it passed my test too.

On 07/21/2014 05:31 PM, Shuah Khan wrote:
> Compiled and booted on my test system. No dmesg regressions.

Thank you all!

-- 
js
suse labs

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

end of thread, other threads:[~2014-07-22  9:02 UTC | newest]

Thread overview: 178+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-18 12:12 [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 001/170] Revert "aio: fix kernel memory disclosure in io_getevents() introduced in v3.10" Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 002/170] ipvs: stop tot_stats estimator only under CONFIG_SYSCTL Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 003/170] netfilter: nf_nat: fix oops on netns removal Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 004/170] rtmutex: Fix deadlock detector for real Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 005/170] rtmutex: Detect changes in the pi lock chain Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 006/170] rtmutex: Handle deadlock detection smarter Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 007/170] rtmutex: Plug slow unlock race Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 008/170] target: Fix left-over se_lun->lun_sep pointer OOPs Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 009/170] iscsi-target: Avoid rejecting incorrect ITT for Data-Out Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 010/170] iscsi-target: Explicily clear login response PDU in exception path Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 011/170] iscsi-target: fix iscsit_del_np deadlock on unload Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 012/170] Input: elantech - deal with clickpads reporting right button events Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 013/170] Input: elantech - don't set bit 1 of reg_10 when the no_hw_res quirk is set Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 014/170] PCI: Add new ID for Intel GPU "spurious interrupt" quirk Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 015/170] PCI: Fix incorrect vgaarb conditional in WARN_ON() Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 016/170] mtip32xx: Fix ERO and NoSnoop values in PCIe upstream on AMD systems Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 017/170] mtip32xx: Increase timeout for STANDBY IMMEDIATE command Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 018/170] mtip32xx: Remove dfs_parent after pci unregister Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 019/170] recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modules Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 020/170] MIPS: MSC: Prevent out-of-bounds writes to MIPS SC ioremap'd region Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 021/170] UBIFS: fix an mmap and fsync race condition Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 022/170] UBIFS: Remove incorrect assertion in shrink_tnc() Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 023/170] watchdog: sp805: Set watchdog_device->timeout from ->set_timeout() Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 024/170] watchdog: ath79_wdt: avoid spurious restarts on AR934x Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 025/170] watchdog: kempld-wdt: Use the correct value when configuring the prescaler with the watchdog Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 026/170] IB/mlx5: add missing padding at end of struct mlx5_ib_create_cq Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 027/170] IB/mlx5: add missing padding at end of struct mlx5_ib_create_srq Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 028/170] IB/qib: Fix port in pkey change event Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 029/170] IB/ipath: Translate legacy diagpkt into newer extended diagpkt Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 030/170] IB/srp: Fix a sporadic crash triggered by cable pulling Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 031/170] IB/umad: Fix error handling Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 032/170] IB/umad: Fix use-after-free on close Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 033/170] SUNRPC: Fix a module reference leak in svc_handle_xprt Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 034/170] pNFS: Handle allocation errors correctly in filelayout_alloc_layout_hdr() Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 035/170] nfsd: getattr for FATTR4_WORD0_FILES_AVAIL needs the statfs buffer Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 036/170] NFS: Don't declare inode uptodate unless all attributes were checked Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 037/170] NFS: populate ->net in mount data when remounting Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 038/170] nfs: Fix cache_validity check in nfs_write_pageuptodate() Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 039/170] powerpc/pseries: Fix overwritten PE state Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 040/170] powerpc/mm: Check paca psize is up to date for huge mappings Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 041/170] powerpc/serial: Use saner flags when creating legacy ports Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 042/170] powerpc: 64bit sendfile is capped at 2GB Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 043/170] powerpc: fix typo 'CONFIG_PMAC' Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 044/170] powerpc/perf: Ensure all EBB register state is cleared on fork() Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 045/170] powerpc: fix typo 'CONFIG_PPC_CPU' Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 046/170] powerpc: Don't setup CPUs with bad status Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 047/170] powerpc: Add AT_HWCAP2 to indicate V.CRYPTO category support Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 048/170] powerpc: Don't skip ePAPR spin-table CPUs Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 049/170] reiserfs: call truncate_setsize under tailpack mutex Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 050/170] MIPS: KVM: Remove redundant NULL checks before kfree() Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 051/170] MIPS: KVM: Fix memory leak on VCPU Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 052/170] ipvs: Fix panic due to non-linear skb Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 053/170] ptrace,x86: force IRET path after a ptrace_stop() Jiri Slaby
2014-07-18 12:10 ` [PATCH 3.12 054/170] lz4: add overrun checks to lz4_uncompress_unknownoutputsize() Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 055/170] Documentation/SubmittingPatches: describe the Fixes: tag Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 056/170] tracing: Try again for saved cmdline if failed due to locking Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 057/170] tracing: Fix syscall_*regfunc() vs copy_process() race Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 058/170] ALSA: usb-audio: Fix races at disconnection and PCM closing Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 059/170] ibmvscsi: Abort init sequence during error recovery Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 060/170] ibmvscsi: Add memory barriers for send / receive Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 061/170] virtio-scsi: avoid cancelling uninitialized work items Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 062/170] scsi_error: fix invalid setting of host byte Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 063/170] virtio-scsi: fix various bad behavior on aborted requests Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 064/170] xhci: correct burst count field for isoc transfers on 1.0 xhci hosts Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 065/170] xhci: Fix runtime suspended xhci from blocking system suspend Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 066/170] USB: option: add device ID for SpeedUp SU9800 usb 3g modem Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 067/170] usb: option: add/modify Olivetti Olicard modems Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 068/170] usb: musb: ux500: don't propagate the OF node Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 069/170] usb: musb: Ensure that cppi41 timer gets armed on premature DMA TX irq Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 070/170] usb: musb: Fix panic upon musb_am335x module removal Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 071/170] usb: chipidea: udc: delete td from req's td list at ep_dequeue Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 072/170] USB: ftdi_sio: fix null deref at port probe Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 073/170] usb: gadget: f_fs: fix NULL pointer dereference when there are no strings Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 074/170] rt2x00: disable TKIP on USB Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 075/170] rt2x00: fix rfkill regression on rt2500pci Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 076/170] mtd: eLBC NAND: fix subpage write support Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 077/170] mtd: nand: omap: fix BCHx ecc.correct to return detected bit-flips in erased-page Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 078/170] vgaswitcheroo: switch the mux to the igp on power down when runpm is enabled Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 079/170] drm/radeon: only apply hdmi bpc pll flags when encoder mode is hdmi Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 080/170] drm/radeon: fix typo in radeon_connector_is_dp12_capable() Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 081/170] drm/radeon/dp: fix lane/clock setup for dp 1.2 capable devices Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 082/170] drm/radeon/atom: fix dithering on certain panels Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 083/170] drm/radeon: don't allow RADEON_GEM_DOMAIN_CPU for command submission Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 084/170] drm/radeon/dpm: fix typo in vddci setup for eg/btc Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 085/170] drm/radeon/dpm: fix vddci setup typo on cayman Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 086/170] drm/radeon/cik: fix typo in EOP packet Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 087/170] drm/vmwgfx: Fix incorrect write to read-only register v2: Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 088/170] Bluetooth: Fix SSP acceptor just-works confirmation without MITM Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 089/170] Bluetooth: Fix indicating discovery state when canceling inquiry Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 090/170] Bluetooth: Fix locking of hdev when calling into SMP code Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 091/170] Bluetooth: Allow change security level on ATT_CID in slave role Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 092/170] dm thin: update discard_granularity to reflect the thin-pool blocksize Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 093/170] rbd: use reference counts for image requests Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 094/170] rbd: handle parent_overlap on writes correctly Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 095/170] hwmon: (ina2xx) Cast to s16 on shunt and current regs Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 096/170] mac80211: fix IBSS join by initializing last_scan_completed Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 097/170] mac80211: don't check netdev state for debugfs read/write Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 098/170] mac80211: fix a memory leak on sta rate selection table Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 099/170] iwlwifi: pcie: try to get ownership several times Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 100/170] hugetlb: fix copy_hugetlb_page_range() to handle migration/hwpoisoned entry Jiri Slaby
2014-07-18 18:53   ` Hugh Dickins
2014-07-20 19:51     ` Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 101/170] mm, pcp: allow restoring percpu_pagelist_fraction default Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 102/170] arm64: mm: Make icache synchronisation logic huge page aware Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 103/170] ARM: OMAP2+: Fix parser-bug in platform muxing code Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 104/170] arm64: Bug fix in stack alignment exception Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 105/170] net: allwinner: emac: Add missing free_irq Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 106/170] b43: fix frequency reported on G-PHY with /new/ firmware Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 107/170] CIFS: fix mount failure with broken pathnames when smb3 mount with mapchars option Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 108/170] blkcg: fix use-after-free in __blkg_release_rcu() by making blkcg_gq refcnt an atomic_t Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 109/170] ext4: Fix buffer double free in ext4_alloc_branch() Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 110/170] ext4: Fix hole punching for files with indirect blocks Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 111/170] KVM: x86: Increase the number of fixed MTRR regs to 10 Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 112/170] KVM: x86: preserve the high 32-bits of the PAT register Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 113/170] iio: of_iio_channel_get_by_name() returns non-null pointers for error legs Jiri Slaby
2014-07-18 12:11 ` [PATCH 3.12 114/170] nfsd: fix rare symlink decoding bug Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 115/170] tools: ffs-test: fix header values endianess Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 116/170] tracing: Remove ftrace_stop/start() from reading the trace file Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 117/170] md: flush writes before starting a recovery Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 118/170] irqchip: spear_shirq: Fix interrupt offset Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 119/170] mm: page_alloc: fix CMA area initialisation when pageblock > MAX_ORDER Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 120/170] serial: Fix IGNBRK handling Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 121/170] tty: Correct INPCK handling Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 122/170] mmc: rtsx: add R1-no-CRC mmc command type handle Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 123/170] ALSA: usb-audio: Suppress repetitive debug messages from retire_playback_urb() Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 124/170] ALSA: usb-audio: Prevent printk ratelimiting from spamming kernel log while DEBUG not defined Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 125/170] sym53c8xx_2: Set DID_REQUEUE return code when aborting squeue Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 126/170] mm: fix crashes from mbind() merging vmas Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 127/170] usb: option: Add ID for Telewell TW-LTE 4G v2 Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 128/170] USB: cp210x: add support for Corsair usb dongle Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 129/170] USB: ftdi_sio: Add extra PID Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 130/170] USB: serial: ftdi_sio: Add Infineon Triboard Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 131/170] iio: ti_am335x_adc: Fix: Use same step id at FIFOs both ends Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 132/170] workqueue: fix dev_set_uevent_suppress() imbalance Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 133/170] cpuset,mempolicy: fix sleeping function called from invalid context Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 134/170] workqueue: zero cpumask of wq_numa_possible_cpumask on init Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 135/170] thermal: hwmon: Make the check for critical temp valid consistent Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 136/170] hwmon: (amc6821) Fix permissions for temp2_input Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 137/170] hwmon: (emc2103) Clamp limits instead of bailing out Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 138/170] hwmon: (adm1031) Fix writes to limit registers Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 139/170] hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 140/170] hwmon: (adm1021) Fix cache problem when writing temperature limits Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 141/170] ACPI / EC: Avoid race condition related to advance_transaction() Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 142/170] ACPI / EC: Add asynchronous command byte write support Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 143/170] ACPI / EC: Remove duplicated ec_wait_ibf0() waiter Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 144/170] ACPI / EC: Fix race condition in ec_transaction_completed() Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 145/170] powerpc/perf: Never program book3s PMCs with values >= 0x80000000 Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 146/170] powerpc/perf: Add PPMU_ARCH_207S define Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 147/170] powerpc/perf: Clear MMCR2 when enabling PMU Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 148/170] cpufreq: Makefile: fix compilation for davinci platform Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 149/170] crypto: sha512_ssse3 - fix byte count to bit count conversion Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 150/170] arm64: implement TASK_SIZE_OF Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 151/170] clk: spear3xx: Use proper control register offset Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 152/170] clk: s2mps11: Fix double free corruption during driver unbind Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 153/170] Drivers: hv: vmbus: Fix a bug in the channel callback dispatch code Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 154/170] dm io: fix a race condition in the wake up code for sync_io Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 155/170] intel_pstate: Set CPU number before accessing MSRs Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 156/170] ext4: fix unjournalled bg descriptor while initializing inode bitmap Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 157/170] ext4: clarify error count warning messages Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 158/170] ext4: clarify ext4_error message in ext4_mb_generate_buddy_error() Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 159/170] ext4: disable synchronous transaction batching if max_batch_time==0 Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 160/170] ext4: fix a potential deadlock in __ext4_es_shrink() Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 161/170] drm/radeon/dpm: Reenabling SS on Cayman Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 162/170] drm/radeon: fix typo in ci_stop_dpm() Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 163/170] drm/radeon: fix typo in golden register setup on evergreen Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 164/170] drm/radeon: stop poisoning the GART TLB Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 165/170] drm/i915: Don't clobber the GTT when it's within stolen memory Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 166/170] DMA, CMA: fix possible memory leak Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 167/170] ring-buffer: Check if buffer exists before polling Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 168/170] powerpc: Disable RELOCATABLE for COMPILE_TEST with PPC64 Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 169/170] x86, ioremap: Speed up check for RAM pages Jiri Slaby
2014-07-18 12:12 ` [PATCH 3.12 170/170] ACPI / battery: Retry to get battery information if failed during probing Jiri Slaby
2014-07-18 12:16 ` [PATCH 3.12 000/170] 3.12.25-stable review Jiri Slaby
2014-07-18 13:47   ` Guenter Roeck
2014-07-19  2:38     ` Satoru Takeuchi
2014-07-22  9:02       ` Jiri Slaby
2014-07-21 15:31   ` Shuah Khan

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