[PATCH 059/222] xfs: fix stray dquot unlock when reclaiming dquots

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Dave Chinner dchin...@redhat.com

commit b870553cdecb26d5291af09602352b763e323df2 upstream.

When we fail to get a dquot lock during reclaim, we jump to an error
handler that unlocks the dquot. This is wrong as we didn't lock the
dquot, and unlocking it means who-ever is holding the lock has had
it silently taken away, and hence it results in a lock imbalance.

Found by inspection while modifying the code for the numa-lru
patchset. This fixes a random hang I've been seeing on xfstest 232
for the past several months.

Signed-off-by: Dave Chinner dchin...@redhat.com
Reviewed-by: Christoph Hellwig h...@lst.de
Signed-off-by: Ben Myers b...@sgi.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 fs/xfs/xfs_qm.c |   15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 249db19..92eb490 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -1453,7 +1453,7 @@ xfs_qm_dqreclaim_one(
int error;
 
if (!xfs_dqlock_nowait(dqp))
-   goto out_busy;
+   goto out_move_tail;
 
/*
 * This dquot has acquired a reference in the meantime remove it from
@@ -1476,7 +1476,7 @@ xfs_qm_dqreclaim_one(
 * getting flushed to disk, we don't want to reclaim it.
 */
if (!xfs_dqflock_nowait(dqp))
-   goto out_busy;
+   goto out_unlock_move_tail;
 
if (XFS_DQ_IS_DIRTY(dqp)) {
struct xfs_buf  *bp = NULL;
@@ -1487,7 +1487,7 @@ xfs_qm_dqreclaim_one(
if (error) {
xfs_warn(mp, %s: dquot %p flush failed,
 __func__, dqp);
-   goto out_busy;
+   goto out_unlock_move_tail;
}
 
xfs_buf_delwri_queue(bp, buffer_list);
@@ -1496,7 +1496,7 @@ xfs_qm_dqreclaim_one(
 * Give the dquot another try on the freelist, as the
 * flushing will take some time.
 */
-   goto out_busy;
+   goto out_unlock_move_tail;
}
xfs_dqfunlock(dqp);
 
@@ -1515,14 +1515,13 @@ xfs_qm_dqreclaim_one(
XFS_STATS_INC(xs_qm_dqreclaims);
return;
 
-out_busy:
-   xfs_dqunlock(dqp);
-
/*
 * Move the dquot to the tail of the list so that we don't spin on it.
 */
+out_unlock_move_tail:
+   xfs_dqunlock(dqp);
+out_move_tail:
list_move_tail(dqp-q_lru, qi-qi_lru_list);
-
trace_xfs_dqreclaim_busy(dqp);
XFS_STATS_INC(xs_qm_dqreclaim_misses);
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 058/222] mlx4_core: Fix potential deadlock in mlx4_eq_int()

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Jack Morgenstein ja...@dev.mellanox.co.il

commit 311f813a2daefcba03f706a692fe0c67888d7622 upstream.

The slave_state_lock spinlock is used in both interrupt context and
process context, hence irq locking must be used.  Found by lockdep.

Signed-off-by: Jack Morgenstein ja...@dev.mellanox.co.il
Signed-off-by: Or Gerlitz ogerl...@mellanox.com
Signed-off-by: Roland Dreier rol...@purestorage.com
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/ethernet/mellanox/mlx4/cmd.c |9 +
 drivers/net/ethernet/mellanox/mlx4/eq.c  |   10 ++
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c 
b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index 842c8ce..92e7057 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -1256,6 +1256,7 @@ static void mlx4_master_do_cmd(struct mlx4_dev *dev, int 
slave, u8 cmd,
u32 reply;
u8 is_going_down = 0;
int i;
+   unsigned long flags;
 
slave_state[slave].comm_toggle ^= 1;
reply = (u32) slave_state[slave].comm_toggle  31;
@@ -1330,12 +1331,12 @@ static void mlx4_master_do_cmd(struct mlx4_dev *dev, 
int slave, u8 cmd,
mlx4_warn(dev, Bad comm cmd:%d from slave:%d\n, cmd, slave);
goto reset_slave;
}
-   spin_lock(priv-mfunc.master.slave_state_lock);
+   spin_lock_irqsave(priv-mfunc.master.slave_state_lock, flags);
if (!slave_state[slave].is_slave_going_down)
slave_state[slave].last_cmd = cmd;
else
is_going_down = 1;
-   spin_unlock(priv-mfunc.master.slave_state_lock);
+   spin_unlock_irqrestore(priv-mfunc.master.slave_state_lock, flags);
if (is_going_down) {
mlx4_warn(dev, Slave is going down aborting command(%d)
   executing from slave:%d\n,
@@ -1351,10 +1352,10 @@ static void mlx4_master_do_cmd(struct mlx4_dev *dev, 
int slave, u8 cmd,
 reset_slave:
/* cleanup any slave resources */
mlx4_delete_all_resources_for_slave(dev, slave);
-   spin_lock(priv-mfunc.master.slave_state_lock);
+   spin_lock_irqsave(priv-mfunc.master.slave_state_lock, flags);
if (!slave_state[slave].is_slave_going_down)
slave_state[slave].last_cmd = MLX4_COMM_CMD_RESET;
-   spin_unlock(priv-mfunc.master.slave_state_lock);
+   spin_unlock_irqrestore(priv-mfunc.master.slave_state_lock, flags);
/*with slave in the middle of flr, no need to clean resources again.*/
 inform_slave_state:
memset(slave_state[slave].event_eq, 0,
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c 
b/drivers/net/ethernet/mellanox/mlx4/eq.c
index bce98d9..aa7b7c3 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -203,6 +203,7 @@ void mlx4_master_handle_slave_flr(struct work_struct *work)
struct mlx4_slave_state *slave_state = priv-mfunc.master.slave_state;
int i;
int err;
+   unsigned long flags;
 
mlx4_dbg(dev, mlx4_handle_slave_flr\n);
 
@@ -214,10 +215,10 @@ void mlx4_master_handle_slave_flr(struct work_struct 
*work)
 
mlx4_delete_all_resources_for_slave(dev, i);
/*return the slave to running mode*/
-   spin_lock(priv-mfunc.master.slave_state_lock);
+   spin_lock_irqsave(priv-mfunc.master.slave_state_lock, 
flags);
slave_state[i].last_cmd = MLX4_COMM_CMD_RESET;
slave_state[i].is_slave_going_down = 0;
-   spin_unlock(priv-mfunc.master.slave_state_lock);
+   
spin_unlock_irqrestore(priv-mfunc.master.slave_state_lock, flags);
/*notify the FW:*/
err = mlx4_cmd(dev, 0, i, 0, MLX4_CMD_INFORM_FLR_DONE,
   MLX4_CMD_TIME_CLASS_A, MLX4_CMD_WRAPPED);
@@ -241,6 +242,7 @@ static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq 
*eq)
u32 flr_slave;
u8 update_slave_state;
int i;
+   unsigned long flags;
 
while ((eqe = next_eqe_sw(eq))) {
/*
@@ -434,13 +436,13 @@ static int mlx4_eq_int(struct mlx4_dev *dev, struct 
mlx4_eq *eq)
} else
update_slave_state = 1;
 
-   spin_lock(priv-mfunc.master.slave_state_lock);
+   spin_lock_irqsave(priv-mfunc.master.slave_state_lock, 
flags);
if (update_slave_state) {

priv-mfunc.master.slave_state[flr_slave].active = false;

priv-mfunc.master.slave_state[flr_slave].last_cmd

[PATCH 051/222] qla2xxx: Look up LUN for abort requests

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Steve Hodgson st...@purestorage.com

commit 06e97b489006f28e23bb028febfa1c01c266d676 upstream.

Search through the list of pending commands on the session list to find
the command the initiator is actually aborting, so that we can pass the
correct LUN to the core TMR handling code.

(nab: Allow abort requests to work to LUN=0 with mainline target code)

Signed-off-by: Steve Hodgson st...@purestorage.com
Signed-off-by: Roland Dreier rol...@purestorage.com
Signed-off-by: Nicholas Bellinger n...@risingtidesystems.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/scsi/qla2xxx/qla_target.c |   21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index f6021cd..714a97d 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -1264,8 +1264,27 @@ static int __qlt_24xx_handle_abts(struct scsi_qla_host 
*vha,
struct abts_recv_from_24xx *abts, struct qla_tgt_sess *sess)
 {
struct qla_hw_data *ha = vha-hw;
+   struct se_session *se_sess = sess-se_sess;
struct qla_tgt_mgmt_cmd *mcmd;
+   struct se_cmd *se_cmd;
+   u32 lun = 0;
int rc;
+   bool found_lun = false;
+
+   spin_lock(se_sess-sess_cmd_lock);
+   list_for_each_entry(se_cmd, se_sess-sess_cmd_list, se_cmd_list) {
+   struct qla_tgt_cmd *cmd =
+   container_of(se_cmd, struct qla_tgt_cmd, se_cmd);
+   if (cmd-tag == abts-exchange_addr_to_abort) {
+   lun = cmd-unpacked_lun;
+   found_lun = true;
+   break;
+   }
+   }
+   spin_unlock(se_sess-sess_cmd_lock);
+
+   if (!found_lun)
+   return -ENOENT;
 
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf00f,
qla_target(%d): task abort (tag=%d)\n,
@@ -1283,7 +1302,7 @@ static int __qlt_24xx_handle_abts(struct scsi_qla_host 
*vha,
mcmd-sess = sess;
memcpy(mcmd-orig_iocb.abts, abts, sizeof(mcmd-orig_iocb.abts));
 
-   rc = ha-tgt.tgt_ops-handle_tmr(mcmd, 0, TMR_ABORT_TASK,
+   rc = ha-tgt.tgt_ops-handle_tmr(mcmd, lun, TMR_ABORT_TASK,
abts-exchange_addr_to_abort);
if (rc != 0) {
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf052,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 039/222] NFS: Add sequence_priviliged_ops for nfs4_proc_sequence()

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Bryan Schumaker bjsch...@netapp.com

commit 6bdb5f213c4344324f600dde885f25768fbd14db upstream.

If I mount an NFS v4.1 server to a single client multiple times and then
run xfstests over each mountpoint I usually get the client into a state
where recovery deadlocks.  The server informs the client of a
cb_path_down sequence error, the client then does a
bind_connection_to_session and checks the status of the lease.

I found that bind_connection_to_session sets the NFS4_SESSION_DRAINING
flag on the client, but this flag is never unset before
nfs4_check_lease() reaches nfs4_proc_sequence().  This causes the client
to deadlock, halting all NFS activity to the server.  nfs4_proc_sequence()
is only called by the state manager, so I can change it to run in privileged
mode to bypass the NFS4_SESSION_DRAINING check and avoid the deadlock.

Signed-off-by: Bryan Schumaker bjsch...@netapp.com
Signed-off-by: Trond Myklebust trond.mykleb...@netapp.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 fs/nfs/nfs4proc.c |   21 +
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 9b1ac5c..c1bad65 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5937,13 +5937,26 @@ static void nfs41_sequence_prepare(struct rpc_task 
*task, void *data)
rpc_call_start(task);
 }
 
+static void nfs41_sequence_prepare_privileged(struct rpc_task *task, void 
*data)
+{
+   rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED);
+   nfs41_sequence_prepare(task, data);
+}
+
 static const struct rpc_call_ops nfs41_sequence_ops = {
.rpc_call_done = nfs41_sequence_call_done,
.rpc_call_prepare = nfs41_sequence_prepare,
.rpc_release = nfs41_sequence_release,
 };
 
-static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp, struct 
rpc_cred *cred)
+static const struct rpc_call_ops nfs41_sequence_privileged_ops = {
+   .rpc_call_done = nfs41_sequence_call_done,
+   .rpc_call_prepare = nfs41_sequence_prepare_privileged,
+   .rpc_release = nfs41_sequence_release,
+};
+
+static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp, struct 
rpc_cred *cred,
+const struct rpc_call_ops *seq_ops)
 {
struct nfs4_sequence_data *calldata;
struct rpc_message msg = {
@@ -5953,7 +5966,7 @@ static struct rpc_task *_nfs41_proc_sequence(struct 
nfs_client *clp, struct rpc_
struct rpc_task_setup task_setup_data = {
.rpc_client = clp-cl_rpcclient,
.rpc_message = msg,
-   .callback_ops = nfs41_sequence_ops,
+   .callback_ops = seq_ops,
.flags = RPC_TASK_ASYNC | RPC_TASK_SOFT,
};
 
@@ -5980,7 +5993,7 @@ static int nfs41_proc_async_sequence(struct nfs_client 
*clp, struct rpc_cred *cr
 
if ((renew_flags  NFS4_RENEW_TIMEOUT) == 0)
return 0;
-   task = _nfs41_proc_sequence(clp, cred);
+   task = _nfs41_proc_sequence(clp, cred, nfs41_sequence_ops);
if (IS_ERR(task))
ret = PTR_ERR(task);
else
@@ -5994,7 +6007,7 @@ static int nfs4_proc_sequence(struct nfs_client *clp, 
struct rpc_cred *cred)
struct rpc_task *task;
int ret;
 
-   task = _nfs41_proc_sequence(clp, cred);
+   task = _nfs41_proc_sequence(clp, cred, nfs41_sequence_privileged_ops);
if (IS_ERR(task)) {
ret = PTR_ERR(task);
goto out;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 040/222] drm/i915: make the panel fitter work on pipes B and C on IVB

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Paulo Zanoni paulo.r.zan...@intel.com

commit 13888d78c664a1f61d7b09d282f5916993827a40 upstream.

I actually found this problem on Haswell, but then discovered Ivy
Bridge also has it by reading the spec.

I don't have the hardware to test this.

Signed-off-by: Paulo Zanoni paulo.r.zan...@intel.com
Reviewed-by: Damien Lespiau damien.lesp...@intel.com
Signed-off-by: Daniel Vetter daniel.vet...@ffwll.ch
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/gpu/drm/i915/i915_reg.h  |2 ++
 drivers/gpu/drm/i915/intel_display.c |6 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 84c04c8..19398df 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -3182,6 +3182,8 @@
 #define _PFA_CTL_1   0x68080
 #define _PFB_CTL_1   0x68880
 #define  PF_ENABLE  (131)
+#define  PF_PIPE_SEL_MASK_IVB  (329)
+#define  PF_PIPE_SEL_IVB(pipe) ((pipe)29)
 #define  PF_FILTER_MASK(323)
 #define  PF_FILTER_PROGRAMMED  (023)
 #define  PF_FILTER_MED_3x3 (123)
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 552a229..f320aaf 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3054,7 +3054,11 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
 * as some pre-programmed values are broken,
 * e.g. x201.
 */
-   I915_WRITE(PF_CTL(pipe), PF_ENABLE | PF_FILTER_MED_3x3);
+   if (IS_IVYBRIDGE(dev))
+   I915_WRITE(PF_CTL(pipe), PF_ENABLE | PF_FILTER_MED_3x3 |
+PF_PIPE_SEL_IVB(pipe));
+   else
+   I915_WRITE(PF_CTL(pipe), PF_ENABLE | PF_FILTER_MED_3x3);
I915_WRITE(PF_WIN_POS(pipe), dev_priv-pch_pf_pos);
I915_WRITE(PF_WIN_SZ(pipe), dev_priv-pch_pf_size);
}
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 043/222] mfd: wm8994: Add support for WM1811 rev E

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Mark Brown broo...@opensource.wolfsonmicro.com

commit fee546ce8cfd9dea1f53175f627e17ef5ff05df4 upstream.

This is supported identically to the previous revisions.

Signed-off-by: Mark Brown broo...@opensource.wolfsonmicro.com
Signed-off-by: Samuel Ortiz sa...@linux.intel.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/mfd/wm8994-core.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index 1e321d3..3e6fbae 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -542,6 +542,7 @@ static __devinit int wm8994_device_init(struct wm8994 
*wm8994, int irq)
case 1:
case 2:
case 3:
+   case 4:
regmap_patch = wm1811_reva_patch;
patch_regs = ARRAY_SIZE(wm1811_reva_patch);
break;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 044/222] Revert 8139cp: revert set ring address before enabling receiver

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: David S. Miller da...@davemloft.net

commit 071e3ef4a94a021b16a2912f3885c86f4ff36b49 upstream.

This reverts commit b26623dab7eeb1e9f5898c7a49458789dd492f20.

This reverts the revert, in net-next we'll try another scheme
to fix this bug using patches from David Woodhouse.

Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/ethernet/realtek/8139cp.c |   22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/realtek/8139cp.c 
b/drivers/net/ethernet/realtek/8139cp.c
index a2679d8..995d0cf 100644
--- a/drivers/net/ethernet/realtek/8139cp.c
+++ b/drivers/net/ethernet/realtek/8139cp.c
@@ -979,6 +979,17 @@ static void cp_init_hw (struct cp_private *cp)
cpw32_f (MAC0 + 0, le32_to_cpu (*(__le32 *) (dev-dev_addr + 0)));
cpw32_f (MAC0 + 4, le32_to_cpu (*(__le32 *) (dev-dev_addr + 4)));
 
+   cpw32_f(HiTxRingAddr, 0);
+   cpw32_f(HiTxRingAddr + 4, 0);
+
+   ring_dma = cp-ring_dma;
+   cpw32_f(RxRingAddr, ring_dma  0x);
+   cpw32_f(RxRingAddr + 4, (ring_dma  16)  16);
+
+   ring_dma += sizeof(struct cp_desc) * CP_RX_RING_SIZE;
+   cpw32_f(TxRingAddr, ring_dma  0x);
+   cpw32_f(TxRingAddr + 4, (ring_dma  16)  16);
+
cp_start_hw(cp);
cpw8(TxThresh, 0x06); /* XXX convert magic num to a constant */
 
@@ -992,17 +1003,6 @@ static void cp_init_hw (struct cp_private *cp)
 
cpw8(Config5, cpr8(Config5)  PMEStatus);
 
-   cpw32_f(HiTxRingAddr, 0);
-   cpw32_f(HiTxRingAddr + 4, 0);
-
-   ring_dma = cp-ring_dma;
-   cpw32_f(RxRingAddr, ring_dma  0x);
-   cpw32_f(RxRingAddr + 4, (ring_dma  16)  16);
-
-   ring_dma += sizeof(struct cp_desc) * CP_RX_RING_SIZE;
-   cpw32_f(TxRingAddr, ring_dma  0x);
-   cpw32_f(TxRingAddr + 4, (ring_dma  16)  16);
-
cpw16(MultiIntr, 0);
 
cpw8_f(Cfg9346, Cfg9346_Lock);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 046/222] USB: OHCI: workaround for hardware bug: retired TDs not added to the Done Queue

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Alan Stern st...@rowland.harvard.edu

commit 50ce5c0683aa83eb161624ea89daa5a9eee0c2ce upstream.

This patch (as1636) is a partial workaround for a hardware bug
affecting OHCI controllers by NVIDIA at least, maybe others too.  When
the controller retires a Transfer Descriptor, it is supposed to add
the TD onto the Done Queue.  But sometimes this doesn't happen, with
the result that ohci-hcd never realizes the corresponding transfer has
finished.  Symptoms can vary; a typical result is that USB audio stops
working after a while.

The patch works around the problem by recognizing that TDs are always
processed in order.  Therefore, if a later TD is found on the Done
Queue than all the earlier TDs for the same endpoint must be finished
as well.

Unfortunately this won't solve the problem in cases where the missing
TD is the last one in the endpoint's queue.  A complete fix would
require a signficant amount of change to the driver.

Signed-off-by: Alan Stern st...@rowland.harvard.edu
Tested-by: Oliver Neukum oneu...@suse.de
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/host/ohci-q.c |   19 +++
 1 file changed, 19 insertions(+)

diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
index c5a1ea9..9d00d47 100644
--- a/drivers/usb/host/ohci-q.c
+++ b/drivers/usb/host/ohci-q.c
@@ -1128,6 +1128,25 @@ dl_done_list (struct ohci_hcd *ohci)
 
while (td) {
struct td   *td_next = td-next_dl_td;
+   struct ed   *ed = td-ed;
+
+   /*
+* Some OHCI controllers (NVIDIA for sure, maybe others)
+* occasionally forget to add TDs to the done queue.  Since
+* TDs for a given endpoint are always processed in order,
+* if we find a TD on the donelist then all of its
+* predecessors must be finished as well.
+*/
+   for (;;) {
+   struct td   *td2;
+
+   td2 = list_first_entry(ed-td_list, struct td,
+   td_list);
+   if (td2 == td)
+   break;
+   takeback_td(ohci, td2);
+   }
+
takeback_td(ohci, td);
td = td_next;
}
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 049/222] usb: ftdi_sio: fixup BeagleBone A5+ quirk

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Peter Korsgaard jac...@sunsite.dk

commit 1a88d5eee2ef2ad1d3c4e32043e9c4c5347d4fc1 upstream.

BeagleBone A5+ devices ended up getting shipped with the
'BeagleBone/XDS100V2' product string, and not XDS100 like it
was agreed, so adjust the quirk to match.

For details, see the thread on the beagle list:

https://groups.google.com/forum/#!msg/beagleboard/zrFPew9_Wvo/ibWr1-eE8JwJ

Signed-off-by: Peter Korsgaard jac...@sunsite.dk
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/serial/ftdi_sio.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index b71ee32..d0b8c5c 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1787,7 +1787,7 @@ static int ftdi_8u2232c_probe(struct usb_serial *serial)
struct usb_device *udev = serial-dev;
 
if ((udev-manufacturer  !strcmp(udev-manufacturer, CALAO 
Systems)) ||
-   (udev-product  !strcmp(udev-product, BeagleBone/XDS100)))
+   (udev-product  !strcmp(udev-product, BeagleBone/XDS100V2)))
return ftdi_jtag_probe(serial);
 
return 0;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 050/222] USB: ftdi_sio: Add support for Newport AGILIS motor drivers

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Martin Teichmann lkb.teichm...@gmail.com

commit d7e14b375b40c04cd735b115713043b69a2c68ac upstream.

The Newport AGILIS model AG-UC8 compact piezo motor controller
(http://search.newport.com/?q=*x2=skuq2=AG-UC8)
is yet another device using an FTDI USB-to-serial chip. It works
fine with the ftdi_sio driver when adding

  options ftdi-sio product=0x3000 vendor=0x104d

to modprobe.d. udevadm reports Newport as the manufacturer,
and Agilis as the product name.

Signed-off-by: Martin Teichmann lkb.teichm...@gmail.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/serial/ftdi_sio.c |1 +
 drivers/usb/serial/ftdi_sio_ids.h |6 ++
 2 files changed, 7 insertions(+)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index d0b8c5c..360bdeb 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -197,6 +197,7 @@ static struct usb_device_id id_table_combined [] = {
{ USB_DEVICE(FTDI_VID, FTDI_OPENDCC_THROTTLE_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GATEWAY_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) },
+   { USB_DEVICE(NEWPORT_VID, NEWPORT_AGILIS_PID) },
{ USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
{ USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_SPROG_II) },
diff --git a/drivers/usb/serial/ftdi_sio_ids.h 
b/drivers/usb/serial/ftdi_sio_ids.h
index 57c12ef..049b6e7 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -752,6 +752,12 @@
 #define TTI_VID0x103E  /* Vendor Id */
 #define TTI_QL355P_PID 0x03E8  /* TTi QL355P power supply */
 
+/*
+ * Newport Cooperation (www.newport.com)
+ */
+#define NEWPORT_VID0x104D
+#define NEWPORT_AGILIS_PID 0x3000
+
 /* Interbiometrics USB I/O Board */
 /* Developed for Interbiometrics by Rudolf Gugler */
 #define INTERBIOMETRICS_VID  0x1209
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 052/222] iscsit: use GFP_ATOMIC under spin lock

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Wei Yongjun yongjun_...@trendmicro.com.cn

commit 3c989d7603872bf878840f7ce3ea49b73bea4c6c upstream.

The function iscsit_build_conn_drop_async_message() is called
from iscsit_close_connection() with spin lock 'sess-conn_lock'
held, so we should use GFP_ATOMIC instead of GFP_KERNEL.

Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn
Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 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 65fc914..ac41f04 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -2382,7 +2382,7 @@ static void iscsit_build_conn_drop_async_message(struct 
iscsi_conn *conn)
if (!conn_p)
return;
 
-   cmd = iscsit_allocate_cmd(conn_p, GFP_KERNEL);
+   cmd = iscsit_allocate_cmd(conn_p, GFP_ATOMIC);
if (!cmd) {
iscsit_dec_conn_usage_count(conn_p);
return;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 048/222] USB: cp210x: add Virtenio Preon32 device id

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Markus Becker m...@comnets.uni-bremen.de

commit 356fe44f4b8ece867bdb9876b1854d7adbef9de2 upstream.

Signed-off-by: Markus Becker m...@comnets.uni-bremen.de
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 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 1e71079..390661a 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -120,6 +120,7 @@ static const struct usb_device_id id_table[] = {
{ USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */
{ USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */
{ USB_DEVICE(0x10C4, 0x85EB) }, /* AC-Services CIS-IBUS */
+   { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */
{ USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */
{ USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */
{ USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 045/222] 8139cp: set ring address after enabling C+ mode

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: David Woodhouse dw...@infradead.org

commit a9dbe40fc10cea2efe6e1ff9e03c62dd7579c5ba upstream.

This fixes (for me) a regression introduced by commit b01af457 (8139cp:
set ring address before enabling receiver). That commit configured the
descriptor ring addresses earlier in the initialisation sequence, in
order to avoid the possibility of triggering stray DMA before the
correct address had been set up.

Unfortunately, it seems that the hardware will scribble garbage into the
TxRingAddr registers when we enable plus mode Tx in the CpCmd
register. Observed on a Traverse Geos router board.

To deal with this, while not reintroducing the problem which led to the
original commit, we augment cp_start_hw() to write to the CpCmd register
*first*, then set the descriptor ring addresses, and then finally to
enable Rx and Tx in the original 8139 Cmd register. The datasheet
actually indicates that we should enable Tx/Rx in the Cmd register
*before* configuring the descriptor addresses, but that would appear to
re-introduce the problem that the offending commit b01af457 was trying
to solve. And this variant appears to work fine on real hardware.

Signed-off-by: David Woodhouse david.woodho...@intel.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/ethernet/realtek/8139cp.c |   40 +++--
 1 file changed, 28 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/realtek/8139cp.c 
b/drivers/net/ethernet/realtek/8139cp.c
index 995d0cf..e0490ad 100644
--- a/drivers/net/ethernet/realtek/8139cp.c
+++ b/drivers/net/ethernet/realtek/8139cp.c
@@ -957,7 +957,35 @@ static void cp_reset_hw (struct cp_private *cp)
 
 static inline void cp_start_hw (struct cp_private *cp)
 {
+   dma_addr_t ring_dma;
+
cpw16(CpCmd, cp-cpcmd);
+
+   /*
+* These (at least TxRingAddr) need to be configured after the
+* corresponding bits in CpCmd are enabled. Datasheet v1.6 §6.33
+* (C+ Command Register) recommends that these and more be configured
+* *after* the [RT]xEnable bits in CpCmd are set. And on some hardware
+* it's been observed that the TxRingAddr is actually reset to garbage
+* when C+ mode Tx is enabled in CpCmd.
+*/
+   cpw32_f(HiTxRingAddr, 0);
+   cpw32_f(HiTxRingAddr + 4, 0);
+
+   ring_dma = cp-ring_dma;
+   cpw32_f(RxRingAddr, ring_dma  0x);
+   cpw32_f(RxRingAddr + 4, (ring_dma  16)  16);
+
+   ring_dma += sizeof(struct cp_desc) * CP_RX_RING_SIZE;
+   cpw32_f(TxRingAddr, ring_dma  0x);
+   cpw32_f(TxRingAddr + 4, (ring_dma  16)  16);
+
+   /*
+* Strictly speaking, the datasheet says this should be enabled
+* *before* setting the descriptor addresses. But what, then, would
+* prevent it from doing DMA to random unconfigured addresses?
+* This variant appears to work fine.
+*/
cpw8(Cmd, RxOn | TxOn);
 }
 
@@ -969,7 +997,6 @@ static void cp_enable_irq(struct cp_private *cp)
 static void cp_init_hw (struct cp_private *cp)
 {
struct net_device *dev = cp-dev;
-   dma_addr_t ring_dma;
 
cp_reset_hw(cp);
 
@@ -979,17 +1006,6 @@ static void cp_init_hw (struct cp_private *cp)
cpw32_f (MAC0 + 0, le32_to_cpu (*(__le32 *) (dev-dev_addr + 0)));
cpw32_f (MAC0 + 4, le32_to_cpu (*(__le32 *) (dev-dev_addr + 4)));
 
-   cpw32_f(HiTxRingAddr, 0);
-   cpw32_f(HiTxRingAddr + 4, 0);
-
-   ring_dma = cp-ring_dma;
-   cpw32_f(RxRingAddr, ring_dma  0x);
-   cpw32_f(RxRingAddr + 4, (ring_dma  16)  16);
-
-   ring_dma += sizeof(struct cp_desc) * CP_RX_RING_SIZE;
-   cpw32_f(TxRingAddr, ring_dma  0x);
-   cpw32_f(TxRingAddr + 4, (ring_dma  16)  16);
-
cp_start_hw(cp);
cpw8(TxThresh, 0x06); /* XXX convert magic num to a constant */
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 042/222] ACPI / PM: Add Sony Vaio VPCEB1S1E to nonvs blacklist.

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Lan Tianyu tianyu@intel.com

commit 876ab79055019e248508cfd0dee7caa3c0c831ed upstream.

Sony Vaio VPCEB1S1E does not resume correctly without
acpi_sleep=nonvs, so add it to the ACPI sleep blacklist.

References: https://bugzilla.kernel.org/show_bug.cgi?id=48781
Reported-by: Sébastien Wilmet swil...@gnome.org
Signed-off-by: Lan Tianyu tianyu@intel.com
Signed-off-by: Rafael J. Wysocki rafael.j.wyso...@intel.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/acpi/sleep.c |8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 8856102..69fd953 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -547,6 +547,14 @@ static struct dmi_system_id __initdata 
acpisleep_dmi_table[] = {
},
{
.callback = init_nvs_nosave,
+   .ident = Sony Vaio VPCEB1S1E,
+   .matches = {
+   DMI_MATCH(DMI_SYS_VENDOR, Sony Corporation),
+   DMI_MATCH(DMI_PRODUCT_NAME, VPCEB1S1E),
+   },
+   },
+   {
+   .callback = init_nvs_nosave,
.ident = Sony Vaio VGN-FW520F,
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, Sony Corporation),
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 037/222] drm: fix documentation for drm_crtc_set_mode()

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Alex Deucher alexander.deuc...@amd.com

commit 4c9287c6009b37754c42e0ba73a4cc79de92d8f8 upstream.

x and y parameters are offsets, not width/height

Signed-off-by: Alex Deucher alexander.deuc...@amd.com
Signed-off-by: Dave Airlie airl...@redhat.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/gpu/drm/drm_crtc_helper.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index 3252e70..1ea423a 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -328,8 +328,8 @@ drm_crtc_prepare_encoders(struct drm_device *dev)
  * drm_crtc_set_mode - set a mode
  * @crtc: CRTC to program
  * @mode: mode to use
- * @x: width of mode
- * @y: height of mode
+ * @x: horizontal offset into the surface
+ * @y: vertical offset into the surface
  *
  * LOCKING:
  * Caller must hold mode config lock.
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 034/222] Bluetooth: Add support for BCM20702A0 [04ca, 2003]

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Jaroslav Resler res...@cs.cas.cz

commit 0c1abbd1aa0416258881c303a88e618cbca0759c upstream.

Add another vendor specific ID for BCM20702A0.

output of usb-devices:
T:  Bus=01 Lev=02 Prnt=02 Port=03 Cnt=02 Dev#=  4 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=04ca ProdID=2003 Rev= 1.12
S:  Manufacturer=Broadcom Corp
S:  Product=BCM20702A0
S:  SerialNumber=446D57861623
C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:  If#= 1 Alt= 2 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=84(I) Atr=02(Bulk) MxPS=  32 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS=  32 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)

Signed-off-by: Cho, Yu-Chen a...@suse.com
Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/bluetooth/btusb.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index e1848be..406e0f9 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -104,6 +104,7 @@ static struct usb_device_id btusb_table[] = {
{ USB_DEVICE(0x0c10, 0x) },
 
/* Broadcom BCM20702A0 */
+   { USB_DEVICE(0x04ca, 0x2003) },
{ USB_DEVICE(0x0489, 0xe042) },
{ USB_DEVICE(0x413c, 0x8197) },
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 036/222] regulator: wm831x: Set the new rather than old value for DVS VSEL

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Mark Brown broo...@opensource.wolfsonmicro.com

commit 13ae633cf729b0ecb677b75b04886ff8fada8fad upstream.

Reported-by: Guennadi Liakhovetski g.liakhovet...@gmx.de
Signed-off-by: Mark Brown broo...@opensource.wolfsonmicro.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/regulator/wm831x-dcdc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index 099da11..1792c46 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -296,7 +296,7 @@ static int wm831x_buckv_set_voltage(struct regulator_dev 
*rdev,
if (vsel  dcdc-dvs_vsel) {
ret = wm831x_set_bits(wm831x, dvs_reg,
  WM831X_DC1_DVS_VSEL_MASK,
- dcdc-dvs_vsel);
+ vsel);
if (ret == 0)
dcdc-dvs_vsel = vsel;
else
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 035/222] Bluetooth: Add support for BCM20702A0 [0b05, 17b5]

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Jeff Cook j...@deserettechnology.com

commit 1ee3ff6110c16acfc915a79b1e3feb5013c41e75 upstream.

Vendor-specific ID for BCM20702A0.
Support for bluetooth over Asus Wi-Fi GO!, included with Asus P8Z77-V
Deluxe.

T:  Bus=07 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  3 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0b05 ProdID=17b5 Rev=01.12
S:  Manufacturer=Broadcom Corp
S:  Product=BCM20702A0
S:  SerialNumber=94DBC98AC113
C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
I:  If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I:  If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)

Signed-off-by: Jeff Cook j...@deserettechnology.com
Signed-off-by: Gustavo Padovan gustavo.pado...@collabora.co.uk
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/bluetooth/btusb.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 406e0f9..37f5ba6 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -104,6 +104,7 @@ static struct usb_device_id btusb_table[] = {
{ USB_DEVICE(0x0c10, 0x) },
 
/* Broadcom BCM20702A0 */
+   { USB_DEVICE(0x0b05, 0x17b5) },
{ USB_DEVICE(0x04ca, 0x2003) },
{ USB_DEVICE(0x0489, 0xe042) },
{ USB_DEVICE(0x413c, 0x8197) },
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 033/222] cgroup: remove incorrect dget/dput() pair in cgroup_create_dir()

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Tejun Heo t...@kernel.org

commit 175431635ec09b1d1bba04979b006b99e8305a83 upstream.

cgroup_create_dir() does weird dancing with dentry refcnt.  On
success, it gets and then puts it achieving nothing.  On failure, it
puts but there isn't no matching get anywhere leading to the following
oops if cgroup_create_file() fails for whatever reason.

  [ cut here ]
  kernel BUG at /work/os/work/fs/dcache.c:552!
  invalid opcode:  [#1] PREEMPT SMP DEBUG_PAGEALLOC
  Modules linked in:
  CPU 2
  Pid: 697, comm: mkdir Not tainted 3.7.0-rc4-work+ #3 Bochs Bochs
  RIP: 0010:[811d9c0c]  [811d9c0c] dput+0x1dc/0x1e0
  RSP: 0018:88001a3ebef8  EFLAGS: 00010246
  RAX:  RBX: 88000e5b1ef8 RCX: 0403
  RDX: 0303 RSI: 2000 RDI: 88000e5b1f58
  RBP: 88001a3ebf18 R08: 82c76960 R09: 0001
  R10: 880015022080 R11: ffd9bed70f48a041 R12: ffea
  R13: 0001 R14: 88000e5b1f58 R15: 7fff57656d60
  FS:  7ff05fcb3800() GS:88001fd0() knlGS:
  CS:  0010 DS:  ES:  CR0: 80050033
  CR2: 004046f0 CR3: 1315f000 CR4: 06e0
  DR0:  DR1:  DR2: 
  DR3:  DR6: 0ff0 DR7: 0400
  Process mkdir (pid: 697, threadinfo 88001a3ea000, task 880015022080)
  Stack:
   88001a3ebf48 ffea 0001 
   88001a3ebf38 811cc889 0001 88000e5b1ef8
   88001a3ebf68 811d1fc9 8800198d7f18 880019106ef8
  Call Trace:
   [811cc889] done_path_create+0x19/0x50
   [811d1fc9] sys_mkdirat+0x59/0x80
   [811d2009] sys_mkdir+0x19/0x20
   [81be1e02] system_call_fastpath+0x16/0x1b
  Code: 00 48 8d 90 18 01 00 00 48 89 93 c0 00 00 00 4c 89 a0 18 01 00 00 48 8b 
83 a0 00 00 00 83 80 28 01 00 00 01 e8 e6 6f a0 00 eb 92 0f 0b 66 90 0f 1f 44 
00 00 55 48 89 e5 41 57 41 56 49 89 fe 41
  RIP  [811d9c0c] dput+0x1dc/0x1e0
   RSP 88001a3ebef8
  ---[ end trace 1277bcfd9561ddb0 ]---

Fix it by dropping the unnecessary dget/dput() pair.

Signed-off-by: Tejun Heo t...@kernel.org
Acked-by: Li Zefan lize...@huawei.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 kernel/cgroup.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index a31b636..1f2c8bf 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2639,9 +2639,7 @@ static int cgroup_create_dir(struct cgroup *cgrp, struct 
dentry *dentry,
dentry-d_fsdata = cgrp;
inc_nlink(parent-d_inode);
rcu_assign_pointer(cgrp-dentry, dentry);
-   dget(dentry);
}
-   dput(dentry);
 
return error;
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 030/222] ftrace: Clear bits properly in reset_iter_read()

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Dan Carpenter dan.carpen...@oracle.com

commit 70f77b3f7ec010ff9624c1f2e39a81babc9e2429 upstream.

There is a typo here where '' is used instead of '|' and it turns the
statement into a noop.  The original code is equivalent to:

iter-flags = ~((1  2)  (1  4));

Link: http://lkml.kernel.org/r/20120609161027.GD6488@elgon.mountain

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com
Signed-off-by: Steven Rostedt rost...@goodmis.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 kernel/trace/ftrace.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index a008663..97da2dc 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2358,7 +2358,7 @@ static void reset_iter_read(struct ftrace_iterator *iter)
 {
iter-pos = 0;
iter-func_pos = 0;
-   iter-flags = ~(FTRACE_ITER_PRINTALL  FTRACE_ITER_HASH);
+   iter-flags = ~(FTRACE_ITER_PRINTALL | FTRACE_ITER_HASH);
 }
 
 static void *t_start(struct seq_file *m, loff_t *pos)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 027/222] rcu: Fix batch-limit size problem

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Eric Dumazet eduma...@google.com

commit 878d7439d0f45a95869e417576774673d1fa243f upstream.

Commit 29c00b4a1d9e27 (rcu: Add event-tracing for RCU callback
invocation) added a regression in rcu_do_batch()

Under stress, RCU is supposed to allow to process all items in queue,
instead of a batch of 10 items (blimit), but an integer overflow makes
the effective limit being 1.  So, unless there is frequent idle periods
(during which RCU ignores batch limits), RCU can be forced into a
state where it cannot keep up with the callback-generation rate,
eventually resulting in OOM.

This commit therefore converts a few variables in rcu_do_batch() from
int to long to fix this problem, along with the module parameters
controlling the batch limits.

Signed-off-by: Eric Dumazet eduma...@google.com
Signed-off-by: Paul E. McKenney paul...@linux.vnet.ibm.com
[ herton: adjust for different module_param permissions ]
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 kernel/rcutree.c |   15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index dd55ba1..232dd61 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -211,13 +211,13 @@ DEFINE_PER_CPU(struct rcu_dynticks, rcu_dynticks) = {
.dynticks = ATOMIC_INIT(1),
 };
 
-static int blimit = 10;/* Maximum callbacks per rcu_do_batch. 
*/
-static int qhimark = 1;/* If this many pending, ignore blimit. */
-static int qlowmark = 100; /* Once only this many pending, use blimit. */
+static long blimit = 10;   /* Maximum callbacks per rcu_do_batch. */
+static long qhimark = 1;   /* If this many pending, ignore blimit. */
+static long qlowmark = 100;/* Once only this many pending, use blimit. */
 
-module_param(blimit, int, 0);
-module_param(qhimark, int, 0);
-module_param(qlowmark, int, 0);
+module_param(blimit, long, 0);
+module_param(qhimark, long, 0);
+module_param(qlowmark, long, 0);
 
 int rcu_cpu_stall_suppress __read_mostly; /* 1 = suppress stall warnings. */
 int rcu_cpu_stall_timeout __read_mostly = CONFIG_RCU_CPU_STALL_TIMEOUT;
@@ -1533,7 +1533,8 @@ static void rcu_do_batch(struct rcu_state *rsp, struct 
rcu_data *rdp)
 {
unsigned long flags;
struct rcu_head *next, *list, **tail;
-   int bl, count, count_lazy, i;
+   long bl, count, count_lazy;
+   int i;
 
/* If no callbacks are ready, just return.*/
if (!cpu_has_callbacks_ready_to_invoke(rdp)) {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 010/222] usb: gadget: uvc: fix error path in uvc_function_bind()

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Sebastian Andrzej Siewior bige...@linutronix.de

commit 0f9df939385527049c8062a099fbfa1479fe7ce0 upstream.

The video-minor = -1 assigment is done in V4L2 by
video_register_device() so it is removed here.
Now. uvc_function_bind() calls in error case uvc_function_unbind() for
cleanup. The problem is that uvc_function_unbind() frees the uvc struct
and uvc_bind_config() does as well in error case of usb_add_function().
Removing kfree() in usb_add_function() would make the patch smaller but
it would look odd because the new allocated memory is not cleaned up.
However it is not guaranteed that if we call usb_add_function() we also
get to the bind function.
Therefore the patch extracts the conditional cleanup from
uvc_function_unbind() applies to uvc_function_bind().
uvc_function_unbind() now contains only the complete cleanup which is
required once everything has been registrated.

Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Bhupesh Sharma bhupesh.sha...@st.com
Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de
Signed-off-by: Felipe Balbi ba...@ti.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/gadget/f_uvc.c |   39 +--
 1 file changed, 21 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/gadget/f_uvc.c b/drivers/usb/gadget/f_uvc.c
index 2022fe49..a0abc65 100644
--- a/drivers/usb/gadget/f_uvc.c
+++ b/drivers/usb/gadget/f_uvc.c
@@ -335,7 +335,6 @@ uvc_register_video(struct uvc_device *uvc)
return -ENOMEM;
 
video-parent = cdev-gadget-dev;
-   video-minor = -1;
video-fops = uvc_v4l2_fops;
video-release = video_device_release;
strncpy(video-name, cdev-gadget-name, sizeof(video-name));
@@ -462,23 +461,12 @@ uvc_function_unbind(struct usb_configuration *c, struct 
usb_function *f)
 
INFO(cdev, uvc_function_unbind\n);
 
-   if (uvc-vdev) {
-   if (uvc-vdev-minor == -1)
-   video_device_release(uvc-vdev);
-   else
-   video_unregister_device(uvc-vdev);
-   uvc-vdev = NULL;
-   }
-
-   if (uvc-control_ep)
-   uvc-control_ep-driver_data = NULL;
-   if (uvc-video.ep)
-   uvc-video.ep-driver_data = NULL;
+   video_unregister_device(uvc-vdev);
+   uvc-control_ep-driver_data = NULL;
+   uvc-video.ep-driver_data = NULL;
 
-   if (uvc-control_req) {
-   usb_ep_free_request(cdev-gadget-ep0, uvc-control_req);
-   kfree(uvc-control_buf);
-   }
+   usb_ep_free_request(cdev-gadget-ep0, uvc-control_req);
+   kfree(uvc-control_buf);
 
kfree(f-descriptors);
kfree(f-hs_descriptors);
@@ -563,7 +551,22 @@ uvc_function_bind(struct usb_configuration *c, struct 
usb_function *f)
return 0;
 
 error:
-   uvc_function_unbind(c, f);
+   if (uvc-vdev)
+   video_device_release(uvc-vdev);
+
+   if (uvc-control_ep)
+   uvc-control_ep-driver_data = NULL;
+   if (uvc-video.ep)
+   uvc-video.ep-driver_data = NULL;
+
+   if (uvc-control_req) {
+   usb_ep_free_request(cdev-gadget-ep0, uvc-control_req);
+   kfree(uvc-control_buf);
+   }
+
+   kfree(f-descriptors);
+   kfree(f-hs_descriptors);
+   kfree(f-ss_descriptors);
return ret;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 015/222] SUNRPC: Fix validity issues with rpc_pipefs sb-s_fs_info

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Trond Myklebust trond.mykleb...@netapp.com

commit 642fe4d00db56d65060ce2fd4c105884414acb16 upstream.

rpc_kill_sb() must defer calling put_net() until after the notifier
has been called, since most (all?) of the notifier callbacks assume
that sb-s_fs_info points to a valid net namespace. It also must not
call put_net() if the call to rpc_fill_super was unsuccessful.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=48421

Signed-off-by: Trond Myklebust trond.mykleb...@netapp.com
Cc: Stanislav Kinsbursky skinsbur...@parallels.com
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 net/sunrpc/rpc_pipe.c |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 21fde99..2a419f1 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -1152,14 +1152,19 @@ static void rpc_kill_sb(struct super_block *sb)
struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
 
mutex_lock(sn-pipefs_sb_lock);
+   if (sn-pipefs_sb != sb) {
+   mutex_unlock(sn-pipefs_sb_lock);
+   goto out;
+   }
sn-pipefs_sb = NULL;
mutex_unlock(sn-pipefs_sb_lock);
-   put_net(net);
dprintk(RPC:   sending pipefs UMOUNT notification for net %p%s\n, net,
NET_NAME(net));
blocking_notifier_call_chain(rpc_pipefs_notifier_list,
   RPC_PIPEFS_UMOUNT,
   sb);
+   put_net(net);
+out:
kill_litter_super(sb);
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 014/222] iscsi-target: Always send a response before terminating iSCSI connection

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Roland Dreier rol...@purestorage.com

commit 1c5c12c666fda27c7c494b34934a0a0631a48130 upstream.

There are some cases, for example when the initiator sends an
out-of-bounds ErrorRecoveryLevel value, where the iSCSI target
terminates the connection without sending back any error.  Audit the
login path and add appropriate iscsit_tx_login_rsp() calls to make
sure this doesn't happen.

Signed-off-by: Roland Dreier rol...@purestorage.com
Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/target/iscsi/iscsi_target_login.c |8 
 drivers/target/iscsi/iscsi_target_nego.c  |   10 --
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_login.c 
b/drivers/target/iscsi/iscsi_target_login.c
index 3cb7a4f..bc7d08f 100644
--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -131,13 +131,13 @@ int iscsi_check_for_session_reinstatement(struct 
iscsi_conn *conn)
 
initiatorname_param = iscsi_find_param_from_key(
INITIATORNAME, conn-param_list);
-   if (!initiatorname_param)
-   return -1;
-
sessiontype_param = iscsi_find_param_from_key(
SESSIONTYPE, conn-param_list);
-   if (!sessiontype_param)
+   if (!initiatorname_param || !sessiontype_param) {
+   iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_INITIATOR_ERR,
+   ISCSI_LOGIN_STATUS_MISSING_FIELDS);
return -1;
+   }
 
sessiontype = (strncmp(sessiontype_param-value, NORMAL, 6)) ? 1 : 0;
 
diff --git a/drivers/target/iscsi/iscsi_target_nego.c 
b/drivers/target/iscsi/iscsi_target_nego.c
index 2dba448..0184bea 100644
--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -628,8 +628,11 @@ static int iscsi_target_handle_csg_one(struct iscsi_conn 
*conn, struct iscsi_log
login-req_buf,
payload_length,
conn-param_list);
-   if (ret  0)
+   if (ret  0) {
+   iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_INITIATOR_ERR,
+   ISCSI_LOGIN_STATUS_INIT_ERR);
return -1;
+   }
 
if (login-first_request)
if (iscsi_target_check_first_request(conn, login)  0)
@@ -644,8 +647,11 @@ static int iscsi_target_handle_csg_one(struct iscsi_conn 
*conn, struct iscsi_log
login-rsp_buf,
login-rsp_length,
conn-param_list);
-   if (ret  0)
+   if (ret  0) {
+   iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_INITIATOR_ERR,
+   ISCSI_LOGIN_STATUS_INIT_ERR);
return -1;
+   }
 
if (!login-auth_complete 
 ISCSI_TPG_ATTRIB(ISCSI_TPG_C(conn))-authentication) {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 020/222] genirq: Always force thread affinity

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Thomas Gleixner t...@linutronix.de

commit 04aa530ec04f61875b99c12721162e2964e3318c upstream.

Sankara reported that the genirq core code fails to adjust the
affinity of an interrupt thread in several cases:

 1) On request/setup_irq() the call to setup_affinity() happens before
the new action is registered, so the new thread is not notified.

 2) For secondary shared interrupts nothing notifies the new thread to
change its affinity.

 3) Interrupts which have the IRQ_NO_BALANCE flag set are not moving
the thread either.

Fix this by setting the thread affinity flag right on thread creation
time. This ensures that under all circumstances the thread moves to
the right place. Requires a check in irq_thread_check_affinity for an
existing affinity mask (CONFIG_CPU_MASK_OFFSTACK=y)

Reported-and-tested-by: Sankara Muthukrishnan sankar...@gmail.com
Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1209041738200.2754@ionos
Signed-off-by: Thomas Gleixner t...@linutronix.de
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 kernel/irq/manage.c |   23 +--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 5e42eb1..b4c6385 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -716,6 +716,7 @@ static void
 irq_thread_check_affinity(struct irq_desc *desc, struct irqaction *action)
 {
cpumask_var_t mask;
+   bool valid = true;
 
if (!test_and_clear_bit(IRQTF_AFFINITY, action-thread_flags))
return;
@@ -730,10 +731,18 @@ irq_thread_check_affinity(struct irq_desc *desc, struct 
irqaction *action)
}
 
raw_spin_lock_irq(desc-lock);
-   cpumask_copy(mask, desc-irq_data.affinity);
+   /*
+* This code is triggered unconditionally. Check the affinity
+* mask pointer. For CPU_MASK_OFFSTACK=n this is optimized out.
+*/
+   if (desc-irq_data.affinity)
+   cpumask_copy(mask, desc-irq_data.affinity);
+   else
+   valid = false;
raw_spin_unlock_irq(desc-lock);
 
-   set_cpus_allowed_ptr(current, mask);
+   if (valid)
+   set_cpus_allowed_ptr(current, mask);
free_cpumask_var(mask);
 }
 #else
@@ -936,6 +945,16 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, 
struct irqaction *new)
 */
get_task_struct(t);
new-thread = t;
+   /*
+* Tell the thread to set its affinity. This is
+* important for shared interrupt handlers as we do
+* not invoke setup_affinity() for the secondary
+* handlers as everything is already set up. Even for
+* interrupts marked with IRQF_NO_BALANCE this is
+* correct as we want the thread to move to the cpu(s)
+* on which the requesting code placed the interrupt.
+*/
+   set_bit(IRQTF_AFFINITY, new-thread_flags);
}
 
if (!alloc_cpumask_var(mask, GFP_KERNEL)) {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 019/222] USB: fix endpoint-disabling for failed config changes

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Alan Stern st...@rowland.harvard.edu

commit 36caff5d795429c572443894e8789c2150dd796b upstream.

This patch (as1631) fixes a bug that shows up when a config change
fails for a device under an xHCI controller.  The controller needs to
be told to disable the endpoints that have been enabled for the new
config.  The existing code does this, but before storing the
information about which endpoints were enabled!  As a result, any
second attempt to install the new config is doomed to fail because
xhci-hcd will refuse to enable an endpoint that is already enabled.

The patch optimistically initializes the new endpoints' device
structures before asking the device to switch to the new config.  If
the request fails then the endpoint information is already stored, so
we can use usb_hcd_alloc_bandwidth() to disable the endpoints with no
trouble.  The rest of the error path is slightly more complex now; we
have to disable the new interfaces and call put_device() rather than
simply deallocating them.

Signed-off-by: Alan Stern st...@rowland.harvard.edu
Reported-and-tested-by: Matthias Schniedermeyer m...@citd.de
CC: Sarah Sharp sarah.a.sh...@linux.intel.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/core/message.c |   54 +---
 1 file changed, 31 insertions(+), 23 deletions(-)

diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 11cc49d..cf8cb4e 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1806,29 +1806,8 @@ free_interfaces:
goto free_interfaces;
}
 
-   ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
- USB_REQ_SET_CONFIGURATION, 0, configuration, 0,
- NULL, 0, USB_CTRL_SET_TIMEOUT);
-   if (ret  0) {
-   /* All the old state is gone, so what else can we do?
-* The device is probably useless now anyway.
-*/
-   cp = NULL;
-   }
-
-   dev-actconfig = cp;
-   if (!cp) {
-   usb_set_device_state(dev, USB_STATE_ADDRESS);
-   usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
-   /* Leave LPM disabled while the device is unconfigured. */
-   mutex_unlock(hcd-bandwidth_mutex);
-   usb_autosuspend_device(dev);
-   goto free_interfaces;
-   }
-   mutex_unlock(hcd-bandwidth_mutex);
-   usb_set_device_state(dev, USB_STATE_CONFIGURED);
-
-   /* Initialize the new interface structures and the
+   /*
+* Initialize the new interface structures and the
 * hc/hcd/usbcore interface/endpoint state.
 */
for (i = 0; i  nintf; ++i) {
@@ -1872,6 +1851,35 @@ free_interfaces:
}
kfree(new_interfaces);
 
+   ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
+ USB_REQ_SET_CONFIGURATION, 0, configuration, 0,
+ NULL, 0, USB_CTRL_SET_TIMEOUT);
+   if (ret  0  cp) {
+   /*
+* All the old state is gone, so what else can we do?
+* The device is probably useless now anyway.
+*/
+   usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
+   for (i = 0; i  nintf; ++i) {
+   usb_disable_interface(dev, cp-interface[i], true);
+   put_device(cp-interface[i]-dev);
+   cp-interface[i] = NULL;
+   }
+   cp = NULL;
+   }
+
+   dev-actconfig = cp;
+   mutex_unlock(hcd-bandwidth_mutex);
+
+   if (!cp) {
+   usb_set_device_state(dev, USB_STATE_ADDRESS);
+
+   /* Leave LPM disabled while the device is unconfigured. */
+   usb_autosuspend_device(dev);
+   return ret;
+   }
+   usb_set_device_state(dev, USB_STATE_CONFIGURED);
+
if (cp-string == NULL 
!(dev-quirks  USB_QUIRK_CONFIG_INTF_STRINGS))
cp-string = usb_cache_string(dev, cp-desc.iConfiguration);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 018/222] perf test: fix a build error on builtin-test

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Zheng Liu gnehzuil@gmail.com

commit 12f8f74b2a4d26c4facfa7ef99487cf0930f6ef7 upstream.

Recently I build perf and get a build error on builtin-test.c. The error is as
following:

$ make
CC perf.o
CC builtin-test.o
cc1: warnings being treated as errors
builtin-test.c: In function ‘sched__get_first_possible_cpu’:
builtin-test.c:977: warning: implicit declaration of function ‘CPU_ALLOC’
builtin-test.c:977: warning: nested extern declaration of ‘CPU_ALLOC’
builtin-test.c:977: warning: assignment makes pointer from integer without a 
cast
builtin-test.c:978: warning: implicit declaration of function ‘CPU_ALLOC_SIZE’
builtin-test.c:978: warning: nested extern declaration of ‘CPU_ALLOC_SIZE’
builtin-test.c:979: warning: implicit declaration of function ‘CPU_ZERO_S’
builtin-test.c:979: warning: nested extern declaration of ‘CPU_ZERO_S’
builtin-test.c:982: warning: implicit declaration of function ‘CPU_FREE’
builtin-test.c:982: warning: nested extern declaration of ‘CPU_FREE’
builtin-test.c:992: warning: implicit declaration of function ‘CPU_ISSET_S’
builtin-test.c:992: warning: nested extern declaration of ‘CPU_ISSET_S’
builtin-test.c:998: warning: implicit declaration of function ‘CPU_CLR_S’
builtin-test.c:998: warning: nested extern declaration of ‘CPU_CLR_S’
make: *** [builtin-test.o] Error 1

This problem is introduced in 3e7c439a. CPU_ALLOC and related macros are
missing in sched__get_first_possible_cpu function. In 54489c18, commiter
mentioned that CPU_ALLOC has been removed. So CPU_ALLOC calls in this
function are removed to let perf to be built.

Signed-off-by: Vinson Lee v...@twitter.com
Signed-off-by: Zheng Liu wenqing...@taobao.com
Cc: David Ahern dsah...@gmail.com
Cc: Frederic Weisbecker fweis...@gmail.com
Cc: Mike Galbraith efa...@gmx.de
Cc: Paul Mackerras pau...@samba.org
Cc: Peter Zijlstra pet...@infradead.org
Cc: Stephane Eranian eran...@google.com
Cc: Vinson Lee v...@twitter.com
Cc: Zheng Liu wenqing...@taobao.com
Link: 
http://lkml.kernel.org/r/1352422726-31114-1-git-send-email-v...@twitter.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
[ herton: builtin-test.c wasn't under tests subdirectory in 3.5 ]
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 tools/perf/builtin-test.c |   38 --
 1 file changed, 12 insertions(+), 26 deletions(-)

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 5a8727c..a3595f0 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -604,19 +604,13 @@ out_free_threads:
 #undef nsyscalls
 }
 
-static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t **maskp,
-size_t *sizep)
+static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp)
 {
-   cpu_set_t *mask;
-   size_t size;
int i, cpu = -1, nrcpus = 1024;
 realloc:
-   mask = CPU_ALLOC(nrcpus);
-   size = CPU_ALLOC_SIZE(nrcpus);
-   CPU_ZERO_S(size, mask);
+   CPU_ZERO(maskp);
 
-   if (sched_getaffinity(pid, size, mask) == -1) {
-   CPU_FREE(mask);
+   if (sched_getaffinity(pid, sizeof(*maskp), maskp) == -1) {
if (errno == EINVAL  nrcpus  (1024  8)) {
nrcpus = nrcpus  2;
goto realloc;
@@ -626,19 +620,14 @@ realloc:
}
 
for (i = 0; i  nrcpus; i++) {
-   if (CPU_ISSET_S(i, size, mask)) {
-   if (cpu == -1) {
+   if (CPU_ISSET(i, maskp)) {
+   if (cpu == -1)
cpu = i;
-   *maskp = mask;
-   *sizep = size;
-   } else
-   CPU_CLR_S(i, size, mask);
+   else
+   CPU_CLR(i, maskp);
}
}
 
-   if (cpu == -1)
-   CPU_FREE(mask);
-
return cpu;
 }
 
@@ -653,8 +642,8 @@ static int test__PERF_RECORD(void)
.freq   = 10,
.mmap_pages = 256,
};
-   cpu_set_t *cpu_mask = NULL;
-   size_t cpu_mask_size = 0;
+   cpu_set_t cpu_mask;
+   size_t cpu_mask_size = sizeof(cpu_mask);
struct perf_evlist *evlist = perf_evlist__new(NULL, NULL);
struct perf_evsel *evsel;
struct perf_sample sample;
@@ -718,8 +707,7 @@ static int test__PERF_RECORD(void)
evsel-attr.sample_type |= PERF_SAMPLE_TIME;
perf_evlist__config_attrs(evlist, opts);
 
-   err = sched__get_first_possible_cpu(evlist-workload.pid, cpu_mask,
-   cpu_mask_size);
+   err = sched__get_first_possible_cpu(evlist-workload.pid, cpu_mask);
if (err  0) {
pr_debug(sched__get_first_possible_cpu: %s\n, 
strerror(errno

[PATCH 023/222] xhci: fix null-pointer dereference when destroying half-built segment rings

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Julius Werner jwer...@chromium.org

commit 68e5254adb88bede68285f11fb442a4d34fb550c upstream.

xhci_alloc_segments_for_ring() builds a list of xhci_segments and links
the tail to head at the end (forming a ring). When it bails out for OOM
reasons half-way through, it tries to destroy its half-built list with
xhci_free_segments_for_ring(), even though it is not a ring yet. This
causes a null-pointer dereference upon hitting the last element.

Furthermore, one of its callers (xhci_ring_alloc()) mistakenly believes
the output parameters to be valid upon this kind of OOM failure, and
calls xhci_ring_free() on them. Since the (incomplete) list/ring should
already be destroyed in that case, this would lead to a use after free.

This patch fixes those issues by having xhci_alloc_segments_for_ring()
destroy its half-built, non-circular list manually and destroying the
invalid struct xhci_ring in xhci_ring_alloc() with a plain kfree().

This patch should be backported to kernels as old as 2.6.31, that
contains the commit 0ebbab37422315a5d0cb29792271085bafdf38c0 USB: xhci:
Ring allocation and initialization.

A separate patch will need to be developed for kernels older than 3.4,
since the ring allocation code was refactored in that kernel.

Signed-off-by: Julius Werner jwer...@chromium.org
Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/host/xhci-mem.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 487bc08..fb51c70 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -205,7 +205,12 @@ static int xhci_alloc_segments_for_ring(struct xhci_hcd 
*xhci,
 
next = xhci_segment_alloc(xhci, cycle_state, flags);
if (!next) {
-   xhci_free_segments_for_ring(xhci, *first);
+   prev = *first;
+   while (prev) {
+   next = prev-next;
+   xhci_segment_free(xhci, prev);
+   prev = next;
+   }
return -ENOMEM;
}
xhci_link_segments(xhci, prev, next, type);
@@ -258,7 +263,7 @@ static struct xhci_ring *xhci_ring_alloc(struct xhci_hcd 
*xhci,
return ring;
 
 fail:
-   xhci_ring_free(xhci, ring);
+   kfree(ring);
return NULL;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 026/222] Staging: bcm: Add two products and remove an existing product.

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Kevin McKinney klmckinn...@gmail.com

commit 4f29ef050848245f7c180b95ccf67dfcd76b1fd8 upstream.

This patch adds two new products and modifies
the device id table to include them. In addition,
product of 0xbccd - BCM_USB_PRODUCT_ID_SM250 is
removed because Beceem, ZTE, Sprint use this id
for block devices.

Reported-by: Muhammad Minhazul Haque mdminhazulha...@gmail.com
Signed-off-by: Kevin McKinney klmckinn...@gmail.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/staging/bcm/InterfaceInit.c |3 ++-
 drivers/staging/bcm/InterfaceInit.h |2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/bcm/InterfaceInit.c 
b/drivers/staging/bcm/InterfaceInit.c
index 8e3c586..da95cd1 100644
--- a/drivers/staging/bcm/InterfaceInit.c
+++ b/drivers/staging/bcm/InterfaceInit.c
@@ -4,10 +4,11 @@ static struct usb_device_id InterfaceUsbtable[] = {
{ USB_DEVICE(BCM_USB_VENDOR_ID_T3, BCM_USB_PRODUCT_ID_T3) },
{ USB_DEVICE(BCM_USB_VENDOR_ID_T3, BCM_USB_PRODUCT_ID_T3B) },
{ USB_DEVICE(BCM_USB_VENDOR_ID_T3, BCM_USB_PRODUCT_ID_T3L) },
-   { USB_DEVICE(BCM_USB_VENDOR_ID_T3, BCM_USB_PRODUCT_ID_SM250) },
+   { USB_DEVICE(BCM_USB_VENDOR_ID_T3, BCM_USB_PRODUCT_ID_SYM) },
{ USB_DEVICE(BCM_USB_VENDOR_ID_ZTE, BCM_USB_PRODUCT_ID_226) },
{ USB_DEVICE(BCM_USB_VENDOR_ID_FOXCONN, BCM_USB_PRODUCT_ID_1901) },
{ USB_DEVICE(BCM_USB_VENDOR_ID_ZTE, BCM_USB_PRODUCT_ID_ZTE_TU25) },
+   { USB_DEVICE(BCM_USB_VENDOR_ID_ZTE, BCM_USB_PRODUCT_ID_ZTE_326) },
{ }
 };
 MODULE_DEVICE_TABLE(usb, InterfaceUsbtable);
diff --git a/drivers/staging/bcm/InterfaceInit.h 
b/drivers/staging/bcm/InterfaceInit.h
index 058315a..384b6a6 100644
--- a/drivers/staging/bcm/InterfaceInit.h
+++ b/drivers/staging/bcm/InterfaceInit.h
@@ -8,10 +8,10 @@
 #define BCM_USB_PRODUCT_ID_T3  0x0300
 #define BCM_USB_PRODUCT_ID_T3B 0x0210
 #define BCM_USB_PRODUCT_ID_T3L 0x0220
-#define BCM_USB_PRODUCT_ID_SM250   0xbccd
 #define BCM_USB_PRODUCT_ID_SYM  0x15E
 #define BCM_USB_PRODUCT_ID_1901 0xe017
 #define BCM_USB_PRODUCT_ID_226  0x0132
+#define BCM_USB_PRODUCT_ID_ZTE_326 0x173 /* ZTE AX326 */
 #define BCM_USB_PRODUCT_ID_ZTE_TU25 0x0007
 
 #define BCM_USB_MINOR_BASE 192
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 021/222] xhci: Fix conditional check in bandwidth calculation.

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Sarah Sharp sarah.a.sh...@linux.intel.com

commit 392a07ae3316f2b90b39ce41e66d6f6b5c95de90 upstream.

David reports that at drivers/usb/host/xhci.c:2257:

static bool xhci_is_sync_in_ep(unsigned int ep_type)
{
return (ep_type == ISOC_IN_EP || ep_type != INT_IN_EP);
}

The static analyser cppcheck says

[linux-3.7-rc2/drivers/usb/host/xhci.c:2257]: (style) Redundant condition: If 
ep_type == 5, the comparison ep_type != 7 is always true.

Maybe the original programmer intention was something like

static bool xhci_is_sync_in_ep(unsigned int ep_type)
{
return (ep_type == ISOC_IN_EP || ep_type == INT_IN_EP);
}

Fix this.

This patch should be backported to stable kernels as old as 3.2, that
contain the commit 2b69899934c63b7b9432568584fb4c4a2924f40c xhci: USB
3.0 BW checking.

Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com
Reported-by: David Binderman dcb...@hotmail.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/host/xhci.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 5f831c2..f67634b 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -2253,7 +2253,7 @@ static bool xhci_is_async_ep(unsigned int ep_type)
 
 static bool xhci_is_sync_in_ep(unsigned int ep_type)
 {
-   return (ep_type == ISOC_IN_EP || ep_type != INT_IN_EP);
+   return (ep_type == ISOC_IN_EP || ep_type == INT_IN_EP);
 }
 
 static unsigned int xhci_get_ss_bw_consumed(struct xhci_bw_info *ep_bw)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 017/222] ARM: mm: use pteval_t to represent page protection values

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Will Deacon will.dea...@arm.com

commit 864aa04cd02979c2c755cb28b5f4fe56039171c0 upstream.

When updating the page protection map after calculating the user_pgprot
value, the base protection map is temporarily stored in an unsigned long
type, causing truncation of the protection bits when LPAE is enabled.
This effectively means that calls to mprotect() will corrupt the upper
page attributes, clearing the XN bit unconditionally.

This patch uses pteval_t to store the intermediate protection values,
preserving the upper bits for 64-bit descriptors.

Acked-by: Nicolas Pitre n...@linaro.org
Acked-by: Catalin Marinas catalin.mari...@arm.com
Signed-off-by: Will Deacon will.dea...@arm.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 arch/arm/mm/mmu.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 15c6abe..f117e1f 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -504,7 +504,7 @@ static void __init build_mem_type_table(void)
 #endif
 
for (i = 0; i  16; i++) {
-   unsigned long v = pgprot_val(protection_map[i]);
+   pteval_t v = pgprot_val(protection_map[i]);
protection_map[i] = __pgprot(v | user_pgprot);
}
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 012/222] usb: musb: cppi_dma: export cppi_interrupt()

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Sergei Shtylyov sshtyl...@ru.mvista.com

commit 8b416b0b25d5d8ddb3a91c1d20e1373582c50405 upstream.

Now that DaVinci glue layer can be modular, we must export cppi_interrupt()
that it may call...

Signed-off-by: Sergei Shtylyov sshtyl...@ru.mvista.com
Signed-off-by: Felipe Balbi ba...@ti.com
[ herton: unfuzz patch ]
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/musb/cppi_dma.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/musb/cppi_dma.c b/drivers/usb/musb/cppi_dma.c
index 8637c1f..c5835e8 100644
--- a/drivers/usb/musb/cppi_dma.c
+++ b/drivers/usb/musb/cppi_dma.c
@@ -1314,6 +1314,7 @@ irqreturn_t cppi_interrupt(int irq, void *dev_id)
 
return IRQ_HANDLED;
 }
+EXPORT_SYMBOL_GPL(cppi_interrupt);
 
 /* Instantiate a software object representing a DMA controller. */
 struct dma_controller *__init
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 008/222] usb: gadget: midi: free hs descriptors

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Sebastian Andrzej Siewior bige...@linutronix.de

commit d185039f7982eb82cf8d03b6fb6689587ca5af24 upstream.

The HS descriptors are only created if HS is supported by the UDC but we
never free them.

Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de
Signed-off-by: Felipe Balbi ba...@ti.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/gadget/f_midi.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/f_midi.c b/drivers/usb/gadget/f_midi.c
index 2f7e8f2..1bf9596 100644
--- a/drivers/usb/gadget/f_midi.c
+++ b/drivers/usb/gadget/f_midi.c
@@ -416,6 +416,7 @@ static void f_midi_unbind(struct usb_configuration *c, 
struct usb_function *f)
midi-id = NULL;
 
usb_free_descriptors(f-descriptors);
+   usb_free_descriptors(f-hs_descriptors);
kfree(midi);
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 006/222] usb: gadget: tcm_usb_gadget: NULL terminate the FS descriptor list

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Sebastian Andrzej Siewior bige...@linutronix.de

commit fad8deb274edcef1c8ca38946338f5f4f8126fe2 upstream.

The descriptor list for FS speed was not NULL terminated. This patch
fixes this.

While here one of the twe two bAlternateSetting assignments for the BOT
interface. Both assign 0, one is enough.

Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de
Signed-off-by: Felipe Balbi ba...@ti.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/gadget/tcm_usb_gadget.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/tcm_usb_gadget.c 
b/drivers/usb/gadget/tcm_usb_gadget.c
index cdfbac7..514366b 100644
--- a/drivers/usb/gadget/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/tcm_usb_gadget.c
@@ -2161,6 +2161,7 @@ static struct usb_descriptor_header 
*uasp_fs_function_desc[] = {
(struct usb_descriptor_header *) uasp_status_pipe_desc,
(struct usb_descriptor_header *) uasp_fs_cmd_desc,
(struct usb_descriptor_header *) uasp_cmd_pipe_desc,
+   NULL,
 };
 
 static struct usb_descriptor_header *uasp_hs_function_desc[] = {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 001/222] KVM: PPC: e500: fix allocation size error on g2h_tlb1_map

2013-01-16 Thread Herton Ronaldo Krzesinski
3.5.7.3 -stable review patch.  If anyone has any objections, please let me know.

--

From: Scott Wood scottw...@freescale.com

commit e400e72f250d2567e89c9bafb47ab91e8d9a15a2 upstream.

We were only allocating half the bytes we need, which was made more
obvious by a recent fix to the memset in  clear_tlb1_bitmap().

Signed-off-by: Scott Wood scottw...@freescale.com
Signed-off-by: Alexander Graf ag...@suse.de
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 arch/powerpc/kvm/e500_tlb.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c
index c510fc9..3580a0c 100644
--- a/arch/powerpc/kvm/e500_tlb.c
+++ b/arch/powerpc/kvm/e500_tlb.c
@@ -1330,7 +1330,7 @@ int kvmppc_e500_tlb_init(struct kvmppc_vcpu_e500 
*vcpu_e500)
if (!vcpu_e500-gtlb_priv[1])
goto err;
 
-   vcpu_e500-g2h_tlb1_map = kzalloc(sizeof(unsigned int) *
+   vcpu_e500-g2h_tlb1_map = kzalloc(sizeof(u64) *
  vcpu_e500-gtlb_params[1].entries,
  GFP_KERNEL);
if (!vcpu_e500-g2h_tlb1_map)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ 18/71] SUNRPC: Ensure we release the socket write lock if the rpc_task exits early

2013-01-17 Thread Herton Ronaldo Krzesinski
On Tue, Jan 15, 2013 at 02:54:15PM -0800, Greg Kroah-Hartman wrote:
 3.0-stable review patch.  If anyone has any objections, please let me know.
 
 --
 
 From: Trond Myklebust trond.mykleb...@netapp.com
 
 commit 87ed50036b866db2ec2ba16b2a7aec4a2b0b7c39 upstream.
 
 If the rpc_task exits while holding the socket write lock before it has
 allocated an rpc slot, then the usual mechanism for releasing the write
 lock in xprt_release() is defeated.
 
 The problem occurs if the call to xprt_lock_write() initially fails, so
 that the rpc_task is put on the xprt-sending wait queue. If the task
 exits after being assigned the lock by __xprt_lock_write_func, but
 before it has retried the call to xprt_lock_and_alloc_slot(), then
 it calls xprt_release() while holding the write lock, but will
 immediately exit due to the test for task-tk_rqstp != NULL.
 
 Reported-by: Chris Perl chris.p...@gmail.com
 Signed-off-by: Trond Myklebust trond.mykleb...@netapp.com
 Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

This is marked only for kernel versions 3.1 and later, which looks
correct as it seems to address a problem starting with commit
43cedbf0e8dfb9c5610eb7985d5f21263e313802

-- 
[]'s
Herton
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ 24/71] ring-buffer: Fix race between integrity check and readers

2013-01-17 Thread Herton Ronaldo Krzesinski
On Tue, Jan 15, 2013 at 02:54:21PM -0800, Greg Kroah-Hartman wrote:
 3.0-stable review patch.  If anyone has any objections, please let me know.
 
 --
 
 From: Steven Rostedt srost...@redhat.com
 
 commit 9366c1ba13fbc41bdb57702e75ca4382f209c82f upstream.
 
 The function rb_check_pages() was added to make sure the ring buffer's
 pages were sane. This check is done when the ring buffer size is modified
 as well as when the iterator is released (closing the trace file),
 as that was considered a non fast path and a good place to do a sanity
 check.
 
 The problem is that the check does not have any locks around it.
 If one process were to read the trace file, and another were to read
 the raw binary file, the check could happen while the reader is reading
 the file.
 
 The issues with this is that the check requires to clear the HEAD page
 before doing the full check and it restores it afterward. But readers
 require the HEAD page to exist before it can read the buffer, otherwise
 it gives a nasty warning and disables the buffer.
 
 By adding the reader lock around the check, this keeps the race from
 happening.
 
 Signed-off-by: Steven Rostedt rost...@goodmis.org
 Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

Too late now (and harmless), but the commit id and changelog are wrong, the
real commit for this backport is 54f7be5b831254199522523ccab4c3d954bbf576
(ring-buffer: Fix NULL pointer if rb_set_head_page() fails). The same
happened with the patch applied on 3.4 this cycle.

-- 
[]'s
Herton
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ 36/71] ext4: lock i_mutex when truncating orphan inodes

2013-01-17 Thread Herton Ronaldo Krzesinski
On Tue, Jan 15, 2013 at 02:54:33PM -0800, Greg Kroah-Hartman wrote:
 3.0-stable review patch.  If anyone has any objections, please let me know.
 
 --
 
 From: Theodore Ts'o ty...@mit.edu
 
 commit 721e3eba21e43532e438652dd8f1fcdfce3187e7 upstream.
 
 Commit c278531d39 added a warning when ext4_flush_unwritten_io() is
 called without i_mutex being taken.  It had previously not been taken
 during orphan cleanup since races weren't possible at that point in
 the mount process, but as a result of this c278531d39, we will now see
 a kernel WARN_ON in this case.  Take the i_mutex in
 ext4_orphan_cleanup() to suppress this warning.
 
 Reported-by: Alexander Beregalov a.berega...@gmail.com
 Signed-off-by: Theodore Ts'o ty...@mit.edu
 Reviewed-by: Zheng Liu wenqing...@taobao.com
 Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

By the description and looking at commit c278531d39, this change isn't
needed for 3.0 or 3.4 kernels (anything = 3.6), they don't contain
commit c278531d39.

 
 ---
  fs/ext4/super.c |2 ++
  1 file changed, 2 insertions(+)
 
 --- a/fs/ext4/super.c
 +++ b/fs/ext4/super.c
 @@ -2204,7 +2204,9 @@ static void ext4_orphan_cleanup(struct s
   __func__, inode-i_ino, inode-i_size);
   jbd_debug(2, truncating inode %lu to %lld bytes\n,
 inode-i_ino, inode-i_size);
 + mutex_lock(inode-i_mutex);
   ext4_truncate(inode);
 + mutex_unlock(inode-i_mutex);
   nr_truncates++;
   } else {
   ext4_msg(sb, KERN_DEBUG,
 
 

-- 
[]'s
Herton
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 013/222] iscsi-target: Fix bug in handling of ExpStatSN ACK during u32 wrap-around

2013-01-17 Thread Herton Ronaldo Krzesinski
On Fri, Jan 18, 2013 at 03:01:46AM +, Ben Hutchings wrote:
 On Wed, 2013-01-16 at 13:53 -0200, Herton Ronaldo Krzesinski wrote:
  3.5.7.3 -stable review patch.  If anyone has any objections, please let me 
  know.
  
  --
  
  From: Steve Hodgson st...@purestorage.com
  
  commit 64c13330a38935120501b19c97a3e6095747c7a1 upstream.
  
  This patch fixes a bug in the hanlding of initiator provided ExpStatSN and
  individual iscsi_cmd-stat_sn comparision during iscsi_conn-stat_sn
  wrap-around within iscsit_ack_from_expstatsn() code.
  
  This bug would manifest itself as iscsi_cmd descriptors not being Acked
  by a lower ExpStatSn, causing them to be leaked until an iSCSI connection
  or session reinstatement event occurs to release all commands.
  
  Also fix up two other uses of incorrect CmdSN SNA comparison to use wrapper
  usage from include/scsi/iscsi_proto.h.
  
  Signed-off-by: Steve Hodgson st...@purestorage.com
  Signed-off-by: Roland Dreier rol...@purestorage.com
  Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
  [ herton: hdr-refcmdsn has the converted be32_to_cpu value on 3.5 ]
  Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
 [...]
 
 You need this as well:
 
 commit 044882a62f34cd6460196c13773bd210be39d717
 Author: Roland Dreier rol...@purestorage.com
 Date:   Mon Jan 7 11:45:16 2013 -0800
 
 iscsi-target: Fix CmdSN comparison (use cmd-cmd_sn instead of 
 cmd-stat_sn)

Thanks, I'll queue it up with final release.

 
 Ben.
 
 -- 
 Ben Hutchings
 It's easier to fight for one's principles than to live up to them.

-- 
[]'s
Herton
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [ 36/71] ext4: lock i_mutex when truncating orphan inodes

2013-01-17 Thread Herton Ronaldo Krzesinski
On Thu, Jan 17, 2013 at 04:46:16PM -0800, Greg Kroah-Hartman wrote:
 On Thu, Jan 17, 2013 at 06:07:11PM -0200, Herton Ronaldo Krzesinski wrote:
  On Tue, Jan 15, 2013 at 02:54:33PM -0800, Greg Kroah-Hartman wrote:
   3.0-stable review patch.  If anyone has any objections, please let me 
   know.
   
   --
   
   From: Theodore Ts'o ty...@mit.edu
   
   commit 721e3eba21e43532e438652dd8f1fcdfce3187e7 upstream.
   
   Commit c278531d39 added a warning when ext4_flush_unwritten_io() is
   called without i_mutex being taken.  It had previously not been taken
   during orphan cleanup since races weren't possible at that point in
   the mount process, but as a result of this c278531d39, we will now see
   a kernel WARN_ON in this case.  Take the i_mutex in
   ext4_orphan_cleanup() to suppress this warning.
   
   Reported-by: Alexander Beregalov a.berega...@gmail.com
   Signed-off-by: Theodore Ts'o ty...@mit.edu
   Reviewed-by: Zheng Liu wenqing...@taobao.com
   Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
  
  By the description and looking at commit c278531d39, this change isn't
  needed for 3.0 or 3.4 kernels (anything = 3.6), they don't contain
  commit c278531d39.
 
 Ah, good catch.  Should this be reverted from 3.0 and 3.4?

I judge it as unecessary from what I saw so far, can ext4 developers
and/or people in Cc confirm? It should be harmless, only consequence is
an uneeded lock being taken now in 3.0/3.4

 
 thanks,
 
 greg k-h
 

-- 
[]'s
Herton
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 3.5.y.z extended stable ] Patch net: calxedaxgmac: throw away overrun frames has been added to staging queue

2013-02-14 Thread Herton Ronaldo Krzesinski
This is a note to let you know that I have just added a patch titled

net: calxedaxgmac: throw away overrun frames

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:

 
http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Herton

--

From f600e21bce4bd4f5c25873bbd8b89b8cdd8dbaef Mon Sep 17 00:00:00 2001
From: Rob Herring rob.herr...@calxeda.com
Date: Wed, 16 Jan 2013 13:36:37 +
Subject: [PATCH] net: calxedaxgmac: throw away overrun frames

commit d6fb3be544b46a7611a3373fcaa62b5b0be01888 upstream.

The xgmac driver assumes 1 frame per descriptor. If a frame larger than
the descriptor's buffer size is received, the frame will spill over into
the next descriptor. So check for received frames that span more than one
descriptor and discard them. This prevents a crash if we receive erroneous
large packets.

Signed-off-by: Rob Herring rob.herr...@calxeda.com
Cc: net...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/ethernet/calxeda/xgmac.c |4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/calxeda/xgmac.c 
b/drivers/net/ethernet/calxeda/xgmac.c
index 8b0a0e4..8a3cd87 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -546,6 +546,10 @@ static int desc_get_rx_status(struct xgmac_priv *priv, 
struct xgmac_dma_desc *p)
return -1;
}

+   /* All frames should fit into a single buffer */
+   if (!(status  RXDESC_FIRST_SEG) || !(status  RXDESC_LAST_SEG))
+   return -1;
+
/* Check if packet has checksum already */
if ((status  RXDESC_FRAME_TYPE)  (status  RXDESC_EXT_STATUS) 
!(ext_status  RXDESC_IP_PAYLOAD_MASK))
--
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 02/81] xhci: Fix TD size for isochronous URBs.

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Sarah Sharp sarah.a.sh...@linux.intel.com

commit f18f8ed2a9adc41c2d9294b85b6af115829d2af1 upstream.

To calculate the TD size for a particular TRB in an isoc TD, we need
know the endpoint's max packet size.  Isochronous endpoints also encode
the number of additional service opportunities in their wMaxPacketSize
field.  The TD size calculation did not mask off those bits before using
the field.  This resulted in incorrect TD size information for
isochronous TRBs when an URB frame buffer crossed a 64KB boundary.

For example:
 - an isoc endpoint has 2 additional service opportunites and
   a max packet size of 1020 bytes
 - a frame transfer buffer contains 3060 bytes
 - one frame buffer crosses a 64KB boundary, and must be split into
   one 1276 byte TRB, and one 1784 byte TRB.

The TD size is is the number of packets that remain to be transferred
for a TD after processing all the max packet sized packets in the
current TRB and all previous TRBs.

For this TD, the number of packets to be transferred is (3060 / 1020),
or 3.  The first TRB contains 1276 bytes, which means it contains one
full packet, and a 256 byte remainder.  After processing all the max
packet-sized packets in the first TRB, the host will have 2 packets left
to transfer.

The old code would calculate the TD size for the first TRB as:

total packet count = DIV_ROUND_UP (TD length / endpoint wMaxPacketSize)
total packet count - (first TRB length / endpoint wMaxPacketSize)

The math should have been:

total packet count = DIV_ROUND_UP (3060 / 1020) = 3
3 - (1276 / 1020) = 2

Since the old code didn't mask off the additional service interval bits
from the wMaxPacketSize field, the math ended up as

total packet count = DIV_ROUND_UP (3060 / 5116) = 1
1 - (1276 / 5116) = 1

Fix this by masking off the number of additional service opportunities
in the wMaxPacketSize field.

This patch should be backported to stable kernels as old as 3.0, that
contain the commit 4da6e6f247a2601ab9f1e63424e4d944ed4124f3 xhci 1.0:
Update TD size field format.  It may not apply well to kernels older
than 3.2 because of commit 29cc88979a8818cd8c5019426e945aed118b400e
USB: use usb_endpoint_maxp() instead of le16_to_cpu().

Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/host/xhci-ring.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 3bf13f8..3dc8e3f 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -3106,7 +3106,7 @@ static u32 xhci_v1_0_td_remainder(int running_total, int 
trb_buff_len,
 * running_total.
 */
packets_transferred = (running_total + trb_buff_len) /
-   usb_endpoint_maxp(urb-ep-desc);
+   GET_MAX_PACKET(usb_endpoint_maxp(urb-ep-desc));
 
if ((total_packet_count - packets_transferred)  31)
return 31  17;
@@ -3640,7 +3640,8 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, 
gfp_t mem_flags,
td_len = urb-iso_frame_desc[i].length;
td_remain_len = td_len;
total_packet_count = DIV_ROUND_UP(td_len,
-   usb_endpoint_maxp(urb-ep-desc));
+   GET_MAX_PACKET(
+   usb_endpoint_maxp(urb-ep-desc)));
/* A zero-length transfer still involves at least one packet. */
if (total_packet_count == 0)
total_packet_count++;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/81] USB: XHCI: fix memory leak of URB-private data

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Alan Stern st...@rowland.harvard.edu

commit 48c3375c5f69b1c2ef3d1051a0009cb9bce0ce24 upstream.

This patch (as1640) fixes a memory leak in xhci-hcd.  The urb_priv
data structure isn't always deallocated in the handle_tx_event()
routine for non-control transfers.  The patch adds a kfree() call so
that all paths end up freeing the memory properly.

This patch should be backported to kernels as old as 2.6.36, that
contain the commit 8e51adccd4c4b9ffcd509d7f2afce0a906139f75 USB: xHCI:
Introduce urb_priv structure

Signed-off-by: Alan Stern st...@rowland.harvard.edu
Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com
Reported-and-tested-by: Martin Mokrejs mmokr...@fold.natur.cuni.cz
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/host/xhci-ring.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 5530c76..6f3043f 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2587,6 +2587,8 @@ cleanup:
(trb_comp_code != COMP_STALL 
trb_comp_code != COMP_BABBLE))
xhci_urb_free_priv(xhci, urb_priv);
+   else
+   kfree(urb_priv);
 
usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb-dev-bus), 
urb);
if ((urb-actual_length != urb-transfer_buffer_length 

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 06/81] usb: Using correct way to clear usb3.0 device's remote wakeup feature.

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Lan Tianyu tianyu@intel.com

commit 54a3ac0c9e5b7213daa358ce74d154352657353a upstream.

Usb3.0 device defines function remote wakeup which is only for interface
recipient rather than device recipient. This is different with usb2.0 device's
remote wakeup feature which is defined for device recipient. According usb3.0
spec 9.4.5, the function remote wakeup can be modified by the SetFeature()
requests using the FUNCTION_SUSPEND feature selector. This patch is to use
correct way to disable usb3.0 device's function remote wakeup after suspend
error and resuming.

This should be backported to kernels as old as 3.4, that contain the
commit 623bef9e03a60adc623b09673297ca7a1cdfb367 USB/xhci: Enable remote
wakeup for USB3 devices.

Signed-off-by: Lan Tianyu tianyu@intel.com
Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com
[ herton: include/uapi/linux/usb/ch9.h - include/linux/usb/ch9.h,
  adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/core/hub.c  |   70 +++
 include/linux/usb/ch9.h |6 
 2 files changed, 58 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 92c0229..c9590c6 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2685,6 +2685,23 @@ static int check_port_resume_type(struct usb_device 
*udev,
 }
 
 #ifdef CONFIG_USB_SUSPEND
+/*
+ * usb_disable_function_remotewakeup - disable usb3.0
+ * device's function remote wakeup
+ * @udev: target device
+ *
+ * Assume there's only one function on the USB 3.0
+ * device and disable remote wake for the first
+ * interface. FIXME if the interface association
+ * descriptor shows there's more than one function.
+ */
+static int usb_disable_function_remotewakeup(struct usb_device *udev)
+{
+   return usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
+   USB_REQ_CLEAR_FEATURE, USB_RECIP_INTERFACE,
+   USB_INTRF_FUNC_SUSPEND, 0, NULL, 0,
+   USB_CTRL_SET_TIMEOUT);
+}
 
 /*
  * usb_port_suspend - suspend a usb device's upstream port
@@ -2797,12 +2814,19 @@ int usb_port_suspend(struct usb_device *udev, 
pm_message_t msg)
dev_dbg(hub-intfdev, can't suspend port %d, status %d\n,
port1, status);
/* paranoia:  should not happen */
-   if (udev-do_remote_wakeup)
-   (void) usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
-   USB_REQ_CLEAR_FEATURE, USB_RECIP_DEVICE,
-   USB_DEVICE_REMOTE_WAKEUP, 0,
-   NULL, 0,
-   USB_CTRL_SET_TIMEOUT);
+   if (udev-do_remote_wakeup) {
+   if (!hub_is_superspeed(hub-hdev)) {
+   (void) usb_control_msg(udev,
+   usb_sndctrlpipe(udev, 0),
+   USB_REQ_CLEAR_FEATURE,
+   USB_RECIP_DEVICE,
+   USB_DEVICE_REMOTE_WAKEUP, 0,
+   NULL, 0,
+   USB_CTRL_SET_TIMEOUT);
+   } else
+   (void) usb_disable_function_remotewakeup(udev);
+
+   }
 
/* Try to enable USB2 hardware LPM again */
if (udev-usb2_hw_lpm_capable == 1)
@@ -2892,20 +2916,30 @@ static int finish_port_resume(struct usb_device *udev)
 * udev-reset_resume
 */
} else if (udev-actconfig  !udev-reset_resume) {
-   le16_to_cpus(devstatus);
-   if (devstatus  (1  USB_DEVICE_REMOTE_WAKEUP)) {
-   status = usb_control_msg(udev,
-   usb_sndctrlpipe(udev, 0),
-   USB_REQ_CLEAR_FEATURE,
+   if (!hub_is_superspeed(udev-parent)) {
+   le16_to_cpus(devstatus);
+   if (devstatus  (1  USB_DEVICE_REMOTE_WAKEUP))
+   status = usb_control_msg(udev,
+   usb_sndctrlpipe(udev, 0),
+   USB_REQ_CLEAR_FEATURE,
USB_RECIP_DEVICE,
-   USB_DEVICE_REMOTE_WAKEUP, 0,
-   NULL, 0,
-   USB_CTRL_SET_TIMEOUT);
-   if (status)
-   dev_dbg(udev-dev,
-   disable remote wakeup, status %d\n

[PATCH 08/81] USB: EHCI: fix timer bug affecting port resume

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Alan Stern st...@rowland.harvard.edu

commit ee74290b7853db9d5fd64db70e5c175241c59fba upstream.

This patch (as1652) fixes a long-standing bug in ehci-hcd.  The driver
relies on status polls to know when to stop port-resume signalling.
It uses the root-hub status timer to schedule these status polls.  But
when the driver for the root hub is resumed, the timer is rescheduled
to go off immediately -- before the port is ready.  When this happens
the timer does not get re-enabled, which prevents the port resume from
finishing until some other event occurs.

The symptom is that when a new device is plugged in, it doesn't get
recognized or enumerated until lsusb is run or something else happens.

The solution is to re-enable the root-hub status timer after every
status poll while a port resume is in progress.

This bug hasn't surfaced before now because we never used to try to
suspend the root hub in the middle of a port resume (except by
coincidence).

Signed-off-by: Alan Stern st...@rowland.harvard.edu
Reported-and-tested-by: Norbert Preining prein...@logic.at
Tested-by: Ming Lei ming@canonical.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/host/ehci-hub.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index fc9e7cc..349d3fe 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -613,7 +613,11 @@ ehci_hub_status_data (struct usb_hcd *hcd, char *buf)
status = STS_PCD;
}
}
-   /* FIXME autosuspend idle root hubs */
+
+   /* If a resume is in progress, make sure it can finish */
+   if (ehci-resuming_ports)
+   mod_timer(hcd-rh_timer, jiffies + msecs_to_jiffies(25));
+
spin_unlock_irqrestore (ehci-lock, flags);
return status ? retval : 0;
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 14/81] drm/radeon: add quirk for RV100 board

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Alex Deucher alexander.deuc...@amd.com

commit 9200ee4941a6e5d1ec5df88982243686882dff3f upstream.

vbios says external TMDS while the board is actually
internal TMDS.

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

Signed-off-by: Alex Deucher alexander.deuc...@amd.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/gpu/drm/radeon/radeon_combios.c |8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_combios.c 
b/drivers/gpu/drm/radeon/radeon_combios.c
index 558e5c0..7139341 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -2455,6 +2455,14 @@ bool radeon_get_legacy_connector_info_from_bios(struct 
drm_device *dev)
   1),
  
ATOM_DEVICE_CRT1_SUPPORT);
}
+   /* RV100 board with external TDMS bit mis-set.
+* Actually uses internal TMDS, clear the bit.
+*/
+   if (dev-pdev-device == 0x5159 
+   dev-pdev-subsystem_vendor == 0x1014 
+   dev-pdev-subsystem_device == 0x029A) {
+   tmp = ~(1  4);
+   }
if ((tmp  4)  0x1) {
devices |= ATOM_DEVICE_DFP2_SUPPORT;
radeon_add_legacy_encoder(dev,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 18/81] drm/radeon: protect against div by 0 in backend setup

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Mikko Tiihonen mikko.tiiho...@iki.fi

commit f689e3acbd2e48cc4101e0af454193f81af4baaf upstream.

Make sure at least one RB is enabled in
r6xx_remap_render_backend() to avoid an division by
zero in some corner cases.

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

Signed-off-by: Alex Deucher alexander.deuc...@amd.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/gpu/drm/radeon/r600.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index bff6272..0c7476d 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1383,12 +1383,15 @@ u32 r6xx_remap_render_backend(struct radeon_device 
*rdev,
  u32 disabled_rb_mask)
 {
u32 rendering_pipe_num, rb_num_width, req_rb_num;
-   u32 pipe_rb_ratio, pipe_rb_remain;
+   u32 pipe_rb_ratio, pipe_rb_remain, tmp;
u32 data = 0, mask = 1  (max_rb_num - 1);
unsigned i, j;
 
/* mask out the RBs that don't exist on that asic */
-   disabled_rb_mask |= (0xff  max_rb_num)  0xff;
+   tmp = disabled_rb_mask | ((0xff  max_rb_num)  0xff);
+   /* make sure at least one RB is available */
+   if ((tmp  0xff) != 0xff)
+   disabled_rb_mask = tmp;
 
rendering_pipe_num = 1  tiling_pipe_num;
req_rb_num = total_max_rb_num - r600_count_pipe_bits(disabled_rb_mask);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 20/81] USB: EHCI: fix bug in scheduling periodic split transfers

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Alan Stern st...@rowland.harvard.edu

commit 3e619d04159be54b3daa0b7036b0ce9e067f4b5d upstream.

This patch (as1654) fixes a very old bug in ehci-hcd, connected with
scheduling of periodic split transfers.  The calculations for
full/low-speed bus usage are all carried out after the correction for
bit-stuffing has been applied, but the values in the max_tt_usecs
array assume it hasn't been.  The array should allow for allocation of
up to 90% of the bus capacity, which is 900 us, not 780 us.

The symptom caused by this bug is that any isochronous transfer to a
full-speed device with a maxpacket size larger than about 980 bytes is
always rejected with a -ENOSPC error.

Signed-off-by: Alan Stern st...@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/host/ehci-sched.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 33182c6..ccc9f70 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -236,7 +236,7 @@ static inline unsigned char tt_start_uframe(struct ehci_hcd 
*ehci, __hc32 mask)
 }
 
 static const unsigned char
-max_tt_usecs[] = { 125, 125, 125, 125, 125, 125, 30, 0 };
+max_tt_usecs[] = { 125, 125, 125, 125, 125, 125, 125, 25 };
 
 /* carryover low/fullspeed bandwidth that crosses uframe boundries */
 static inline void carryover_tt_bandwidth(unsigned short tt_usecs[8])
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 25/81] drm/radeon: prevent crash in the ring space allocation

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Alex Deucher alexander.deuc...@amd.com

commit fd5d93a0015ce1a7db881382022b2fcdfdc61760 upstream.

If the requested number of DWs on the ring is larger than
the size of the ring itself, return an error.

In testing with large VM updates, we've seen crashes when we
try and allocate more space on the ring than the total size
of the ring without checking.

This prevents the crash but for large VM updates or bo moves
of very large buffers, we will need to break the transaction
down into multiple batches.  I have patches to use IBs for
the next kernel.

Signed-off-by: Alex Deucher alexander.deuc...@amd.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/gpu/drm/radeon/radeon_ring.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_ring.c 
b/drivers/gpu/drm/radeon/radeon_ring.c
index 7843b36..727ebfe 100644
--- a/drivers/gpu/drm/radeon/radeon_ring.c
+++ b/drivers/gpu/drm/radeon/radeon_ring.c
@@ -219,6 +219,9 @@ int radeon_ring_alloc(struct radeon_device *rdev, struct 
radeon_ring *ring, unsi
 {
int r;
 
+   /* make sure we aren't trying to allocate more space than there is on 
the ring */
+   if (ndw  (ring-ring_size / 4))
+   return -ENOMEM;
/* Align requested size with padding so unlock_commit can
 * pad safely */
ndw = (ndw + ring-align_mask)  ~ring-align_mask;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 31/81] USB: ftdi_sio: add Zolix FTDI PID

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: =?UTF-8?q?Petr=20Kub=C3=A1nek?= p...@kubanek.net

commit 0ba3b2ccc72b3df5c305d61f59d93ab0f0e87991 upstream.

Add support for Zolix Omni 1509 monochromator custom USB-RS232 converter.

Signed-off-by: Petr Kubánek p...@kubanek.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/serial/ftdi_sio.c |1 +
 drivers/usb/serial/ftdi_sio_ids.h |5 +
 2 files changed, 6 insertions(+)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 031b23c..4c1fa24 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -677,6 +677,7 @@ static struct usb_device_id id_table_combined [] = {
{ USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) },
{ USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) },
{ USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) },
+   { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) },
{ USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_MHAM_KW_PID) },
diff --git a/drivers/usb/serial/ftdi_sio_ids.h 
b/drivers/usb/serial/ftdi_sio_ids.h
index 7c89cfc..9d359e18 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -147,6 +147,11 @@
 #define XSENS_CONVERTER_6_PID  0xD38E
 #define XSENS_CONVERTER_7_PID  0xD38F
 
+/**
+ * Zolix (www.zolix.com.cb) product ids
+ */
+#define FTDI_OMNI1509  0xD491  /* Omni1509 embedded USB-serial 
*/
+
 /*
  * NDI (www.ndigital.com) product ids
  */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 33/81] USB: storage: optimize to match the Huawei USB storage devices and support new switch command

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: fangxiaozhi huana...@huawei.com

commit 200e0d994d9d1919b28c87f1a5fb99a8e13b8a0f upstream.

1. Optimize the match rules with new macro for Huawei USB storage devices,
   to avoid to load USB storage driver for the modem interface
   with Huawei devices.
2. Add to support new switch command for new Huawei USB dongles.

Signed-off-by: fangxiaozhi huana...@huawei.com
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/storage/initializers.c |   76 -
 drivers/usb/storage/initializers.h |4 +-
 drivers/usb/storage/unusual_devs.h |  329 +---
 3 files changed, 78 insertions(+), 331 deletions(-)

diff --git a/drivers/usb/storage/initializers.c 
b/drivers/usb/storage/initializers.c
index 105d900..16b0bf0 100644
--- a/drivers/usb/storage/initializers.c
+++ b/drivers/usb/storage/initializers.c
@@ -92,8 +92,8 @@ int usb_stor_ucr61s2b_init(struct us_data *us)
return 0;
 }
 
-/* This places the HUAWEI E220 devices in multi-port mode */
-int usb_stor_huawei_e220_init(struct us_data *us)
+/* This places the HUAWEI usb dongles in multi-port mode */
+static int usb_stor_huawei_feature_init(struct us_data *us)
 {
int result;
 
@@ -104,3 +104,75 @@ int usb_stor_huawei_e220_init(struct us_data *us)
US_DEBUGP(Huawei mode set result is %d\n, result);
return 0;
 }
+
+/*
+ * It will send a scsi switch command called rewind' to huawei dongle.
+ * When the dongle receives this command at the first time,
+ * it will reboot immediately. After rebooted, it will ignore this command.
+ * So it is  unnecessary to read its response.
+ */
+static int usb_stor_huawei_scsi_init(struct us_data *us)
+{
+   int result = 0;
+   int act_len = 0;
+   struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us-iobuf;
+   char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00,
+   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+   bcbw-Signature = cpu_to_le32(US_BULK_CB_SIGN);
+   bcbw-Tag = 0;
+   bcbw-DataTransferLength = 0;
+   bcbw-Flags = bcbw-Lun = 0;
+   bcbw-Length = sizeof(rewind_cmd);
+   memset(bcbw-CDB, 0, sizeof(bcbw-CDB));
+   memcpy(bcbw-CDB, rewind_cmd, sizeof(rewind_cmd));
+
+   result = usb_stor_bulk_transfer_buf(us, us-send_bulk_pipe, bcbw,
+   US_BULK_CB_WRAP_LEN, act_len);
+   US_DEBUGP(transfer actual length=%d, result=%d\n, act_len, result);
+   return result;
+}
+
+/*
+ * It tries to find the supported Huawei USB dongles.
+ * In Huawei, they assign the following product IDs
+ * for all of their mobile broadband dongles,
+ * including the new dongles in the future.
+ * So if the product ID is not included in this list,
+ * it means it is not Huawei's mobile broadband dongles.
+ */
+static int usb_stor_huawei_dongles_pid(struct us_data *us)
+{
+   struct usb_interface_descriptor *idesc;
+   int idProduct;
+
+   idesc = us-pusb_intf-cur_altsetting-desc;
+   idProduct = us-pusb_dev-descriptor.idProduct;
+   /* The first port is CDROM,
+* means the dongle in the single port mode,
+* and a switch command is required to be sent. */
+   if (idesc  idesc-bInterfaceNumber == 0) {
+   if ((idProduct == 0x1001)
+   || (idProduct == 0x1003)
+   || (idProduct == 0x1004)
+   || (idProduct = 0x1401  idProduct = 0x1500)
+   || (idProduct = 0x1505  idProduct = 0x1600)
+   || (idProduct = 0x1c02  idProduct = 0x2202)) {
+   return 1;
+   }
+   }
+   return 0;
+}
+
+int usb_stor_huawei_init(struct us_data *us)
+{
+   int result = 0;
+
+   if (usb_stor_huawei_dongles_pid(us)) {
+   if (us-pusb_dev-descriptor.idProduct = 0x1446)
+   result = usb_stor_huawei_scsi_init(us);
+   else
+   result = usb_stor_huawei_feature_init(us);
+   }
+   return result;
+}
diff --git a/drivers/usb/storage/initializers.h 
b/drivers/usb/storage/initializers.h
index 529327f..5376d4f 100644
--- a/drivers/usb/storage/initializers.h
+++ b/drivers/usb/storage/initializers.h
@@ -46,5 +46,5 @@ int usb_stor_euscsi_init(struct us_data *us);
  * flash reader */
 int usb_stor_ucr61s2b_init(struct us_data *us);
 
-/* This places the HUAWEI E220 devices in multi-port mode */
-int usb_stor_huawei_e220_init(struct us_data *us);
+/* This places the HUAWEI usb dongles in multi-port mode */
+int usb_stor_huawei_init(struct us_data *us);
diff --git a/drivers/usb/storage/unusual_devs.h 
b/drivers/usb/storage/unusual_devs.h
index dd2c64f..fff5d10 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage

[PATCH 35/81] nilfs2: fix fix very long mount time issue

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Vyacheslav Dubeyko sl...@dubeyko.com

commit a9bae189542e71f91e61a4428adf6e5a7dfe8063 upstream.

There exists a situation when GC can work in background alone without
any other filesystem activity during significant time.

The nilfs_clean_segments() method calls nilfs_segctor_construct() that
updates superblocks in the case of NILFS_SC_SUPER_ROOT and
THE_NILFS_DISCONTINUED flags are set.  But when GC is working alone the
nilfs_clean_segments() is called with unset THE_NILFS_DISCONTINUED flag.
As a result, the update of superblocks doesn't occurred all this time
and in the case of SPOR superblocks keep very old values of last super
root placement.

SYMPTOMS:

Trying to mount a NILFS2 volume after SPOR in such environment ends with
very long mounting time (it can achieve about several hours in some
cases).

REPRODUCING PATH:

1. It needs to use external USB HDD, disable automount and doesn't
   make any additional filesystem activity on the NILFS2 volume.

2. Generate temporary file with size about 100 - 500 GB (for example,
   dd if=/dev/zero of=file_name bs=1073741824 count=200).  The size of
   file defines duration of GC working.

3. Then it needs to delete file.

4. Start GC manually by means of command nilfs-clean -p 0.  When you
   start GC by means of such way then, at the end, superblocks is updated
   by once.  So, for simulation of SPOR, it needs to wait sometime (15 -
   40 minutes) and simply switch off USB HDD manually.

5. Switch on USB HDD again and try to mount NILFS2 volume.  As a
   result, NILFS2 volume will mount during very long time.

REPRODUCIBILITY: 100%

FIX:

This patch adds checking that superblocks need to update and set
THE_NILFS_DISCONTINUED flag before nilfs_clean_segments() call.

Reported-by: Sergey Alexandrov spla...@gmail.com
Signed-off-by: Vyacheslav Dubeyko sl...@dubeyko.com
Tested-by: Vyacheslav Dubeyko sl...@dubeyko.com
Acked-by: Ryusuke Konishi konishi.ryus...@lab.ntt.co.jp
Tested-by: Ryusuke Konishi konishi.ryus...@lab.ntt.co.jp
Signed-off-by: Andrew Morton a...@linux-foundation.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 fs/nilfs2/ioctl.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index 0b6387c..29990c9 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -666,8 +666,11 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, 
struct file *filp,
if (ret  0)
printk(KERN_ERR NILFS: GC failed during preparation: 
cannot read source blocks: err=%d\n, ret);
-   else
+   else {
+   if (nilfs_sb_need_update(nilfs))
+   set_nilfs_discontinued(nilfs);
ret = nilfs_clean_segments(inode-i_sb, argv, kbufs);
+   }
 
nilfs_remove_all_gcinodes(nilfs);
clear_nilfs_gc_running(nilfs);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 37/81] drivers/rtc/rtc-isl1208.c: call rtc_update_irq() from the alarm irq handler

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Jan Luebbe j...@pengutronix.de

commit 72fca4a4b32dc778b5b885c3498700e42b610d49 upstream.

Previously the alarm event was not propagated into the RTC subsystem.
By adding a call to rtc_update_irq, this fixes a timeout problem with
the hwclock utility.

Signed-off-by: Jan Luebbe j...@pengutronix.de
Cc: Alessandro Zummo a.zu...@towertech.it
Signed-off-by: Andrew Morton a...@linux-foundation.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/rtc/rtc-isl1208.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index dd2aeee..8f8c8ae 100644
--- a/drivers/rtc/rtc-isl1208.c
+++ b/drivers/rtc/rtc-isl1208.c
@@ -494,6 +494,7 @@ isl1208_rtc_interrupt(int irq, void *data)
 {
unsigned long timeout = jiffies + msecs_to_jiffies(1000);
struct i2c_client *client = data;
+   struct rtc_device *rtc = i2c_get_clientdata(client);
int handled = 0, sr, err;
 
/*
@@ -516,6 +517,8 @@ isl1208_rtc_interrupt(int irq, void *data)
if (sr  ISL1208_REG_SR_ALM) {
dev_dbg(client-dev, alarm!\n);
 
+   rtc_update_irq(rtc, 1, RTC_IRQF | RTC_AF);
+
/* Clear the alarm */
sr = ~ISL1208_REG_SR_ALM;
sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, sr);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 39/81] virtio_console: Don't access uninitialized data.

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: =?UTF-8?q?Sjur=20Br=C3=A6ndeland?= sjur.brandel...@stericsson.com

commit aded024a12b32fc1ed9a80639681daae2d07ec25 upstream.

Don't access uninitialized work-queue when removing device.
The work queue is initialized only if the device multi-queue.
So don't call cancel_work unless this is a multi-queue device.

This fixes the following panic:

Kernel panic - not syncing: BUG!
Call Trace:
62031b28:  [6026085d] panic+0x16b/0x2d3
62031b30:  [6004ef5e] flush_work+0x0/0x1d7
62031b60:  [602606f2] panic+0x0/0x2d3
62031b68:  [600333b0] memcpy+0x0/0x140
62031b80:  [6002d58a] unblock_signals+0x0/0x84
62031ba0:  [602609c5] printk+0x0/0xa0
62031bd8:  [60264e51] __mutex_unlock_slowpath+0x13d/0x148
62031c10:  [6004ef5e] flush_work+0x0/0x1d7
62031c18:  [60050234] try_to_grab_pending+0x0/0x17e
62031c38:  [6004e984] get_work_gcwq+0x71/0x8f
62031c48:  [60050539] __cancel_work_timer+0x5b/0x115
62031c78:  [628acc85] unplug_port+0x0/0x191 [virtio_console]
62031c98:  [6005061c] cancel_work_sync+0x12/0x14
62031ca8:  [628ace96] virtcons_remove+0x80/0x15c [virtio_console]
62031ce8:  [628191de] virtio_dev_remove+0x1e/0x7e [virtio]
62031d08:  [601cf242] __device_release_driver+0x75/0xe4
62031d28:  [601cf2dd] device_release_driver+0x2c/0x40
62031d48:  [601ce0dd] driver_unbind+0x7d/0xc6
62031d88:  [601cd5d9] drv_attr_store+0x27/0x29
62031d98:  [60115f61] sysfs_write_file+0x100/0x14d
62031df8:  [600b737d] vfs_write+0xcb/0x184
62031e08:  [600b58b8] filp_close+0x88/0x94
62031e38:  [600b7686] sys_write+0x59/0x88
62031e88:  [6001ced1] handle_syscall+0x5d/0x80
62031ea8:  [60030a74] userspace+0x405/0x531
62031f08:  [600d32cc] sys_dup+0x0/0x5e
62031f28:  [601b11d6] strcpy+0x0/0x18
62031f38:  [600be46c] do_execve+0x10/0x12
62031f48:  [600184c7] run_init_process+0x43/0x45
62031fd8:  [60019a91] new_thread_handler+0xba/0xbc

Signed-off-by: Sjur Brændeland sjur.brandel...@stericsson.com
Signed-off-by: Rusty Russell ru...@rustcorp.com.au
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/char/virtio_console.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index cdf2f54..f77e341 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1808,7 +1808,8 @@ static void virtcons_remove(struct virtio_device *vdev)
/* Disable interrupts for vqs */
vdev-config-reset(vdev);
/* Finish up work that's lined up */
-   cancel_work_sync(portdev-control_work);
+   if (use_multiport(portdev))
+   cancel_work_sync(portdev-control_work);
 
list_for_each_entry_safe(port, port2, portdev-ports, list)
unplug_port(port);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 42/81] be2net: Fix to trim skb for padded vlan packets to workaround an ASIC Bug

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Somnath Kotur somnath.ko...@emulex.com

commit 93040ae5cc8dcc893eca4a4366dc8415af278edf upstream.

Fixed spelling error in a comment as pointed out by DaveM.
Also refactored existing code a bit to provide placeholders for another ASIC
Bug workaround that will be checked-in soon after this.

Signed-off-by: Somnath Kotur somnath.ko...@emulex.com
Signed-off-by: David S. Miller da...@davemloft.net
Cc: Jacek Luczak difrost.ker...@gmail.com
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/ethernet/emulex/benet/be.h  |5 +++
 drivers/net/ethernet/emulex/benet/be_main.c |   56 ---
 2 files changed, 47 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be.h 
b/drivers/net/ethernet/emulex/benet/be.h
index c5c4c0e..793ee6b 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -573,6 +573,11 @@ static inline u8 is_udp_pkt(struct sk_buff *skb)
return val;
 }
 
+static inline bool is_ipv4_pkt(struct sk_buff *skb)
+{
+   return skb-protocol == ntohs(ETH_P_IP)  ip_hdr(skb)-version == 4;
+}
+
 static inline void be_vf_eth_addr_generate(struct be_adapter *adapter, u8 *mac)
 {
u32 addr;
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c 
b/drivers/net/ethernet/emulex/benet/be_main.c
index bd5cf7e..dc36f5c 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -576,6 +576,11 @@ static inline u16 be_get_tx_vlan_tag(struct be_adapter 
*adapter,
return vlan_tag;
 }
 
+static int be_vlan_tag_chk(struct be_adapter *adapter, struct sk_buff *skb)
+{
+   return vlan_tx_tag_present(skb) || adapter-pvid;
+}
+
 static void wrb_fill_hdr(struct be_adapter *adapter, struct be_eth_hdr_wrb 
*hdr,
struct sk_buff *skb, u32 wrb_cnt, u32 len)
 {
@@ -703,33 +708,56 @@ dma_err:
return 0;
 }
 
+static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter,
+struct sk_buff *skb)
+{
+   u16 vlan_tag = 0;
+
+   skb = skb_share_check(skb, GFP_ATOMIC);
+   if (unlikely(!skb))
+   return skb;
+
+   if (vlan_tx_tag_present(skb)) {
+   vlan_tag = be_get_tx_vlan_tag(adapter, skb);
+   __vlan_put_tag(skb, vlan_tag);
+   skb-vlan_tci = 0;
+   }
+
+   return skb;
+}
+
 static netdev_tx_t be_xmit(struct sk_buff *skb,
struct net_device *netdev)
 {
struct be_adapter *adapter = netdev_priv(netdev);
struct be_tx_obj *txo = adapter-tx_obj[skb_get_queue_mapping(skb)];
struct be_queue_info *txq = txo-q;
+   struct iphdr *ip = NULL;
u32 wrb_cnt = 0, copied = 0;
-   u32 start = txq-head;
+   u32 start = txq-head, eth_hdr_len;
bool dummy_wrb, stopped = false;
 
-   /* For vlan tagged pkts, BE
-* 1) calculates checksum even when CSO is not requested
-* 2) calculates checksum wrongly for padded pkt less than
-* 60 bytes long.
-* As a workaround disable TX vlan offloading in such cases.
+   eth_hdr_len = ntohs(skb-protocol) == ETH_P_8021Q ?
+   VLAN_ETH_HLEN : ETH_HLEN;
+
+   /* HW has a bug which considers padding bytes as legal
+* and modifies the IPv4 hdr's 'tot_len' field
 */
-   if (unlikely(vlan_tx_tag_present(skb) 
-(skb-ip_summed != CHECKSUM_PARTIAL || skb-len = 60))) {
-   skb = skb_share_check(skb, GFP_ATOMIC);
-   if (unlikely(!skb))
-   goto tx_drop;
+   if (skb-len = 60  be_vlan_tag_chk(adapter, skb) 
+   is_ipv4_pkt(skb)) {
+   ip = (struct iphdr *)ip_hdr(skb);
+   pskb_trim(skb, eth_hdr_len + ntohs(ip-tot_len));
+   }
 
-   skb = __vlan_put_tag(skb, be_get_tx_vlan_tag(adapter, skb));
+   /* HW has a bug wherein it will calculate CSUM for VLAN
+* pkts even though it is disabled.
+* Manually insert VLAN in pkt.
+*/
+   if (skb-ip_summed != CHECKSUM_PARTIAL 
+   be_vlan_tag_chk(adapter, skb)) {
+   skb = be_insert_vlan_in_pkt(adapter, skb);
if (unlikely(!skb))
goto tx_drop;
-
-   skb-vlan_tci = 0;
}
 
wrb_cnt = wrb_cnt_for_skb(adapter, skb, dummy_wrb);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 43/81] net: prevent setting ttl=0 via IP_TTL

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Cong Wang xiyou.wangc...@gmail.com

commit c9be4a5c49cf51cc70a993f004c5bb30067a65ce upstream.

A regression is introduced by the following commit:

commit 4d52cfbef6266092d535237ba5a4b981458ab171
Author: Eric Dumazet eric.duma...@gmail.com
Date:   Tue Jun 2 00:42:16 2009 -0700

net: ipv4/ip_sockglue.c cleanups

Pure cleanups

but it is not a pure cleanup...

-   if (val != -1  (val  1 || val255))
+   if (val != -1  (val  0 || val  255))

Since there is no reason provided to allow ttl=0, change it back.

Reported-by: nitin padalia padalia.ni...@gmail.com
Cc: nitin padalia padalia.ni...@gmail.com
Cc: Eric Dumazet eric.duma...@gmail.com
Cc: David S. Miller da...@davemloft.net
Signed-off-by: Cong Wang xiyou.wangc...@gmail.com
Acked-by: Eric Dumazet eduma...@google.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 net/ipv4/ip_sockglue.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 8285f00..aabeb7b 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -589,7 +589,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
case IP_TTL:
if (optlen  1)
goto e_inval;
-   if (val != -1  (val  0 || val  255))
+   if (val != -1  (val  1 || val  255))
goto e_inval;
inet-uc_ttl = val;
break;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 46/81] ipv6: fix header length calculation in ip6_append_data()

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Romain KUNTZ r.ku...@ipflavors.com

commit 7efdba5bd9a2f3e2059beeb45c9fa55eefe1bced upstream.

Commit 299b0767 (ipv6: Fix IPsec slowpath fragmentation problem)
has introduced a error in the header length calculation that
provokes corrupted packets when non-fragmentable extensions
headers (Destination Option or Routing Header Type 2) are used.

rt-rt6i_nfheader_len is the length of the non-fragmentable
extension header, and it should be substracted to
rt-dst.header_len, and not to exthdrlen, as it was done before
commit 299b0767.

This patch reverts to the original and correct behavior. It has
been successfully tested with and without IPsec on packets
that include non-fragmentable extensions headers.

Signed-off-by: Romain Kuntz r.ku...@ipflavors.com
Acked-by: Steffen Klassert steffen.klass...@secunet.com
Signed-off-by: David S. Miller da...@davemloft.net
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 net/ipv6/ip6_output.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index decc21d1..4703c70 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1293,10 +1293,10 @@ int ip6_append_data(struct sock *sk, int getfrag(void 
*from, char *to,
cork-length = 0;
sk-sk_sndmsg_page = NULL;
sk-sk_sndmsg_off = 0;
-   exthdrlen = (opt ? opt-opt_flen : 0) - rt-rt6i_nfheader_len;
+   exthdrlen = (opt ? opt-opt_flen : 0);
length += exthdrlen;
transhdrlen += exthdrlen;
-   dst_exthdrlen = rt-dst.header_len;
+   dst_exthdrlen = rt-dst.header_len - rt-rt6i_nfheader_len;
} else {
rt = (struct rt6_info *)cork-dst;
fl6 = inet-cork.fl.u.ip6;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 49/81] net/mlx4_en: Fix bridged vSwitch configuration for non SRIOV mode

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Yan Burman y...@mellanox.com

commit 213815a1e6ae70b9648483b110bc5081795f99e8 upstream.

Commit 5b4c4d36860e mlx4_en: Allow communication between functions on
same host introduced a regression under which a bridge acting as vSwitch
whose uplink is an mlx4 Ethernet device become non-operative in native
(non sriov) mode. This happens since broadcast ARP requests sent by VMs
were loopback-ed by the HW and hence the bridge learned VM source MACs
on both the VM and the uplink ports.

The fix is to place the DMAC in the send WQE only under SRIOV/eSwitch
configuration or when the device is in selftest.

Reviewed-by: Or Gerlitz ogerl...@mellanox.com
Signed-off-by: Yan Burman y...@mellanox.com
Signed-off-by: Amir Vadai am...@mellanox.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/ethernet/mellanox/mlx4/en_tx.c |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c 
b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 019d856..8ba03c9 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -633,10 +633,15 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct 
net_device *dev)
ring-tx_csum++;
}
 
-   /* Copy dst mac address to wqe */
-   ethh = (struct ethhdr *)skb-data;
-   tx_desc-ctrl.srcrb_flags16[0] = get_unaligned((__be16 *)ethh-h_dest);
-   tx_desc-ctrl.imm = get_unaligned((__be32 *)(ethh-h_dest + 2));
+   if (mlx4_is_mfunc(mdev-dev) || priv-validate_loopback) {
+   /* Copy dst mac address to wqe. This allows loopback in eSwitch,
+* so that VFs and PF can communicate with each other
+*/
+   ethh = (struct ethhdr *)skb-data;
+   tx_desc-ctrl.srcrb_flags16[0] = get_unaligned((__be16 
*)ethh-h_dest);
+   tx_desc-ctrl.imm = get_unaligned((__be32 *)(ethh-h_dest + 2));
+   }
+
/* Handle LSO (TSO) packets */
if (lso_header_size) {
/* Mark opcode as LSO */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 52/81] netxen: fix off by one bug in netxen_release_tx_buffer()

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Eric Dumazet eduma...@google.com

commit a05948f296ce103989b28a2606e47d2e287c3c89 upstream.

Christoph Paasch found netxen could trigger a BUG in its dismantle
phase, in netxen_release_tx_buffer(), using full size TSO packets.

cmd_buf-frag_count includes the skb-data part, so the loop must
start at index 1 instead of 0, or else we can make an out
of bound access to cmd_buff-frag_array[MAX_SKB_FRAGS + 2]

Christoph provided the fixes in netxen_map_tx_skb() function.
In case of a dma mapping error, its better to clear the dma fields
so that we don't try to unmap them again in netxen_release_tx_buffer()

Reported-by: Christoph Paasch christoph.paa...@uclouvain.be
Signed-off-by: Eric Dumazet eduma...@google.com
Tested-by: Christoph Paasch christoph.paa...@uclouvain.be
Cc: Sony Chacko sony.cha...@qlogic.com
Cc: Rajesh Borundia rajesh.borun...@qlogic.com
Signed-off-by: Christoph Paasch christoph.paa...@uclouvain.be
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 .../net/ethernet/qlogic/netxen/netxen_nic_init.c   |2 +-
 .../net/ethernet/qlogic/netxen/netxen_nic_main.c   |2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c 
b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
index 8694124..fdddfcc 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
@@ -144,7 +144,7 @@ void netxen_release_tx_buffers(struct netxen_adapter 
*adapter)
 buffrag-length, PCI_DMA_TODEVICE);
buffrag-dma = 0ULL;
}
-   for (j = 0; j  cmd_buf-frag_count; j++) {
+   for (j = 1; j  cmd_buf-frag_count; j++) {
buffrag++;
if (buffrag-dma) {
pci_unmap_page(adapter-pdev, buffrag-dma,
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c 
b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index a77c558..d6a8218 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -1963,10 +1963,12 @@ unwind:
while (--i = 0) {
nf = pbuf-frag_array[i+1];
pci_unmap_page(pdev, nf-dma, nf-length, PCI_DMA_TODEVICE);
+   nf-dma = 0ULL;
}
 
nf = pbuf-frag_array[0];
pci_unmap_single(pdev, nf-dma, skb_headlen(skb), PCI_DMA_TODEVICE);
+   nf-dma = 0ULL;
 
 out_err:
return -ENOMEM;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 55/81] pktgen: correctly handle failures when adding a device

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Cong Wang amw...@redhat.com

commit 604dfd6efc9b79bce432f2394791708d8e8f6efc upstream.

The return value of pktgen_add_device() is not checked, so
even if we fail to add some device, for example, non-exist one,
we still see OK: This patch fixes it.

After this patch, I got:

# echo add_device non-exist  /proc/net/pktgen/kpktgend_0
-bash: echo: write error: No such device
# cat /proc/net/pktgen/kpktgend_0
Running:
Stopped:
Result: ERROR: can not add device non-exist
# echo add_device eth0  /proc/net/pktgen/kpktgend_0
# cat /proc/net/pktgen/kpktgend_0
Running:
Stopped: eth0
Result: OK: add_device=eth0

(Candidate for -stable)

Cc: David S. Miller da...@davemloft.net
Signed-off-by: Cong Wang amw...@redhat.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 net/core/pktgen.c |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index aa278cd..2a42802 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1797,10 +1797,13 @@ static ssize_t pktgen_thread_write(struct file *file,
return -EFAULT;
i += len;
mutex_lock(pktgen_thread_lock);
-   pktgen_add_device(t, f);
+   ret = pktgen_add_device(t, f);
mutex_unlock(pktgen_thread_lock);
-   ret = count;
-   sprintf(pg_result, OK: add_device=%s, f);
+   if (!ret) {
+   ret = count;
+   sprintf(pg_result, OK: add_device=%s, f);
+   } else
+   sprintf(pg_result, ERROR: can not add device %s, f);
goto out;
}
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 57/81] via-rhine: Fix bugs in NAPI support.

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: David S. Miller da...@davemloft.net

commit 559bcac35facfed49ab4f408e162971612dcfdf3 upstream.

1) rhine_tx() should use dev_kfree_skb() not dev_kfree_skb_irq()

2) rhine_slow_event_task's NAPI triggering logic is racey, it
   should just hit the interrupt mask register.  This is the
   same as commit 7dbb491878a2c51d372a8890fa45a8ff80358af1
   (r8169: avoid NAPI scheduling delay.) made to fix the same
   problem in the r8169 driver.  From Francois Romieu.

Reported-by: Jamie Gloudon jamie.glou...@gmail.com
Tested-by: Jamie Gloudon jamie.glou...@gmail.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/ethernet/via/via-rhine.c |8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/via/via-rhine.c 
b/drivers/net/ethernet/via/via-rhine.c
index 0459c09..046526e0 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -1802,7 +1802,7 @@ static void rhine_tx(struct net_device *dev)
 rp-tx_skbuff[entry]-len,
 PCI_DMA_TODEVICE);
}
-   dev_kfree_skb_irq(rp-tx_skbuff[entry]);
+   dev_kfree_skb(rp-tx_skbuff[entry]);
rp-tx_skbuff[entry] = NULL;
entry = (++rp-dirty_tx) % TX_RING_SIZE;
}
@@ -2011,11 +2011,7 @@ static void rhine_slow_event_task(struct work_struct 
*work)
if (intr_status  IntrPCIErr)
netif_warn(rp, hw, dev, PCI error\n);
 
-   napi_disable(rp-napi);
-   rhine_irq_disable(rp);
-   /* Slow and safe. Consider __napi_schedule as a replacement ? */
-   napi_enable(rp-napi);
-   napi_schedule(rp-napi);
+   iowrite16(RHINE_EVENT  0x, rp-base + IntrEnable);
 
 out_unlock:
mutex_unlock(rp-task_lock);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 59/81] atm/iphase: rename fregt_t - ffreg_t

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Heiko Carstens heiko.carst...@de.ibm.com

commit ab54ee80aa7585f9666ff4dd665441d7ce41f1e8 upstream.

We have conflicting type qualifiers for freg_t in s390's ptrace.h and the
iphase atm device driver, which causes the compile error below.
Unfortunately the s390 typedef can't be renamed, since it's a user visible api,
nor can I change the include order in s390 code to avoid the conflict.

So simply rename the iphase typedef to a new name. Fixes this compile error:

In file included from drivers/atm/iphase.c:66:0:
drivers/atm/iphase.h:639:25: error: conflicting type qualifiers for 'freg_t'
In file included from next/arch/s390/include/asm/ptrace.h:9:0,
 from next/arch/s390/include/asm/lowcore.h:12,
 from next/arch/s390/include/asm/thread_info.h:30,
 from include/linux/thread_info.h:54,
 from include/linux/preempt.h:9,
 from include/linux/spinlock.h:50,
 from include/linux/seqlock.h:29,
 from include/linux/time.h:5,
 from include/linux/stat.h:18,
 from include/linux/module.h:10,
 from drivers/atm/iphase.c:43:
next/arch/s390/include/uapi/asm/ptrace.h:197:3: note: previous declaration of 
'freg_t' was here

Signed-off-by: Heiko Carstens heiko.carst...@de.ibm.com
Acked-by: chas williams - CONTRACTOR c...@cmf.nrl.navy.mil
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/atm/iphase.h |  146 +-
 1 file changed, 73 insertions(+), 73 deletions(-)

diff --git a/drivers/atm/iphase.h b/drivers/atm/iphase.h
index 6a0955e..53ecac5 100644
--- a/drivers/atm/iphase.h
+++ b/drivers/atm/iphase.h
@@ -636,82 +636,82 @@ struct rx_buf_desc {
 #define SEG_BASE IPHASE5575_FRAG_CONTROL_REG_BASE  
 #define REASS_BASE IPHASE5575_REASS_CONTROL_REG_BASE  
 
-typedef volatile u_int  freg_t;
+typedef volatile u_int ffreg_t;
 typedef u_int   rreg_t;
 
 typedef struct _ffredn_t {
-freg_t  idlehead_high;  /* Idle cell header (high)  */
-freg_t  idlehead_low;   /* Idle cell header (low)   */
-freg_t  maxrate;/* Maximum rate */
-freg_t  stparms;/* Traffic Management Parameters*/
-freg_t  abrubr_abr; /* ABRUBR Priority Byte 1, TCR Byte 0   */
-freg_t  rm_type;/*  */
-u_int   filler5[0x17 - 0x06];
-freg_t  cmd_reg;/* Command register */
-u_int   filler18[0x20 - 0x18];
-freg_t  cbr_base;   /* CBR Pointer Base */
-freg_t  vbr_base;   /* VBR Pointer Base */
-freg_t  abr_base;   /* ABR Pointer Base */
-freg_t  ubr_base;   /* UBR Pointer Base */
-u_int   filler24;
-freg_t  vbrwq_base; /* VBR Wait Queue Base  */
-freg_t  abrwq_base; /* ABR Wait Queue Base  */
-freg_t  ubrwq_base; /* UBR Wait Queue Base  */
-freg_t  vct_base;   /* Main VC Table Base   */
-freg_t  vcte_base;  /* Extended Main VC Table Base  */
-u_int   filler2a[0x2C - 0x2A];
-freg_t  cbr_tab_beg;/* CBR Table Begin  */
-freg_t  cbr_tab_end;/* CBR Table End*/
-freg_t  cbr_pointer;/* CBR Pointer  */
-u_int   filler2f[0x30 - 0x2F];
-freg_t  prq_st_adr; /* Packet Ready Queue Start Address */
-freg_t  prq_ed_adr; /* Packet Ready Queue End Address   */
-freg_t  prq_rd_ptr; /* Packet Ready Queue read pointer  */
-freg_t  prq_wr_ptr; /* Packet Ready Queue write pointer */
-freg_t  tcq_st_adr; /* Transmit Complete Queue Start Address*/
-freg_t  tcq_ed_adr; /* Transmit Complete Queue End Address  */
-freg_t  tcq_rd_ptr; /* Transmit Complete Queue read pointer */
-freg_t  tcq_wr_ptr; /* Transmit Complete Queue write pointer*/
-u_int   filler38[0x40 - 0x38];
-freg_t  queue_base; /* Base address for PRQ and TCQ */
-freg_t  desc_base;  /* Base address of descriptor table */
-u_int   filler42[0x45 - 0x42];
-freg_t  mode_reg_0; /* Mode register 0  */
-freg_t  mode_reg_1; /* Mode register 1  */
-freg_t  intr_status_reg;/* Interrupt Status register*/
-freg_t  mask_reg;   /* Mask Register*/
-freg_t  cell_ctr_high1; /* Total cell

[PATCH 61/81] net: sctp: sctp_setsockopt_auth_key: use kzfree instead of kfree

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Daniel Borkmann dbork...@redhat.com

commit 6ba542a291a5e558603ac51cda9bded347ce7627 upstream.

In sctp_setsockopt_auth_key, we create a temporary copy of the user
passed shared auth key for the endpoint or association and after
internal setup, we free it right away. Since it's sensitive data, we
should zero out the key before returning the memory back to the
allocator. Thus, use kzfree instead of kfree, just as we do in
sctp_auth_key_put().

Signed-off-by: Daniel Borkmann dbork...@redhat.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 net/sctp/socket.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 944cfce..957bb6e 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -3375,7 +3375,7 @@ static int sctp_setsockopt_auth_key(struct sock *sk,
 
ret = sctp_auth_set_key(sctp_sk(sk)-ep, asoc, authkey);
 out:
-   kfree(authkey);
+   kzfree(authkey);
return ret;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 64/81] xen/netback: don't leak pages on failure in xen_netbk_tx_check_gop.

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Matthew Daley mat...@gmail.com

commit 7d5145d8eb2b9791533ffe4dc003b129b9696c48 upstream.

Signed-off-by: Matthew Daley mat...@gmail.com
Reviewed-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com
Acked-by: Ian Campbell ian.campb...@citrix.com
Acked-by: Jan Beulich jbeul...@suse.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/xen-netback/netback.c |   38 +
 1 file changed, 13 insertions(+), 25 deletions(-)

diff --git a/drivers/net/xen-netback/netback.c 
b/drivers/net/xen-netback/netback.c
index ae321c0..e7913e0 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -146,7 +146,8 @@ void xen_netbk_remove_xenvif(struct xenvif *vif)
atomic_dec(netbk-netfront_count);
 }
 
-static void xen_netbk_idx_release(struct xen_netbk *netbk, u16 pending_idx);
+static void xen_netbk_idx_release(struct xen_netbk *netbk, u16 pending_idx,
+ u8 status);
 static void make_tx_response(struct xenvif *vif,
 struct xen_netif_tx_request *txp,
 s8   st);
@@ -978,30 +979,20 @@ static int xen_netbk_tx_check_gop(struct xen_netbk *netbk,
 {
struct gnttab_copy *gop = *gopp;
u16 pending_idx = *((u16 *)skb-data);
-   struct pending_tx_info *pending_tx_info = netbk-pending_tx_info;
-   struct xenvif *vif = pending_tx_info[pending_idx].vif;
-   struct xen_netif_tx_request *txp;
struct skb_shared_info *shinfo = skb_shinfo(skb);
int nr_frags = shinfo-nr_frags;
int i, err, start;
 
/* Check status of header. */
err = gop-status;
-   if (unlikely(err)) {
-   pending_ring_idx_t index;
-   index = pending_index(netbk-pending_prod++);
-   txp = pending_tx_info[pending_idx].req;
-   make_tx_response(vif, txp, XEN_NETIF_RSP_ERROR);
-   netbk-pending_ring[index] = pending_idx;
-   xenvif_put(vif);
-   }
+   if (unlikely(err))
+   xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_ERROR);
 
/* Skip first skb fragment if it is on same page as header fragment. */
start = (frag_get_pending_idx(shinfo-frags[0]) == pending_idx);
 
for (i = start; i  nr_frags; i++) {
int j, newerr;
-   pending_ring_idx_t index;
 
pending_idx = frag_get_pending_idx(shinfo-frags[i]);
 
@@ -1010,16 +1001,12 @@ static int xen_netbk_tx_check_gop(struct xen_netbk 
*netbk,
if (likely(!newerr)) {
/* Had a previous error? Invalidate this fragment. */
if (unlikely(err))
-   xen_netbk_idx_release(netbk, pending_idx);
+   xen_netbk_idx_release(netbk, pending_idx, 
XEN_NETIF_RSP_OKAY);
continue;
}
 
/* Error on this fragment: respond to client with an error. */
-   txp = netbk-pending_tx_info[pending_idx].req;
-   make_tx_response(vif, txp, XEN_NETIF_RSP_ERROR);
-   index = pending_index(netbk-pending_prod++);
-   netbk-pending_ring[index] = pending_idx;
-   xenvif_put(vif);
+   xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_ERROR);
 
/* Not the first error? Preceding frags already invalidated. */
if (err)
@@ -1027,10 +1014,10 @@ static int xen_netbk_tx_check_gop(struct xen_netbk 
*netbk,
 
/* First error: invalidate header and preceding fragments. */
pending_idx = *((u16 *)skb-data);
-   xen_netbk_idx_release(netbk, pending_idx);
+   xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_OKAY);
for (j = start; j  i; j++) {
pending_idx = frag_get_pending_idx(shinfo-frags[j]);
-   xen_netbk_idx_release(netbk, pending_idx);
+   xen_netbk_idx_release(netbk, pending_idx, 
XEN_NETIF_RSP_OKAY);
}
 
/* Remember the error: invalidate all subsequent fragments. */
@@ -1064,7 +1051,7 @@ static void xen_netbk_fill_frags(struct xen_netbk *netbk, 
struct sk_buff *skb)
 
/* Take an extra reference to offset xen_netbk_idx_release */
get_page(netbk-mmap_pages[pending_idx]);
-   xen_netbk_idx_release(netbk, pending_idx);
+   xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_OKAY);
}
 }
 
@@ -1447,7 +1434,7 @@ static void xen_netbk_tx_submit(struct xen_netbk *netbk)
txp-size -= data_len;
} else {
/* Schedule a response

[PATCH 65/81] xen/netback: free already allocated memory on failure in xen_netbk_get_requests

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Ian Campbell ian.campb...@citrix.com

commit 4cc7c1cb7b11b6f3515bd9075527576a1eecc4aa upstream.

Signed-off-by: Ian Campbell ian.campb...@citrix.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/xen-netback/netback.c |   13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/xen-netback/netback.c 
b/drivers/net/xen-netback/netback.c
index e7913e0..c503a58 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -949,7 +949,7 @@ static struct gnttab_copy *xen_netbk_get_requests(struct 
xen_netbk *netbk,
pending_idx = netbk-pending_ring[index];
page = xen_netbk_alloc_page(netbk, skb, pending_idx);
if (!page)
-   return NULL;
+   goto err;
 
gop-source.u.ref = txp-gref;
gop-source.domid = vif-domid;
@@ -971,6 +971,17 @@ static struct gnttab_copy *xen_netbk_get_requests(struct 
xen_netbk *netbk,
}
 
return gop;
+err:
+   /* Unwind, freeing all pages and sending error responses. */
+   while (i--  start) {
+   xen_netbk_idx_release(netbk, frag_get_pending_idx(frags[i]),
+ XEN_NETIF_RSP_ERROR);
+   }
+   /* The head too, if necessary. */
+   if (start)
+   xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_ERROR);
+
+   return NULL;
 }
 
 static int xen_netbk_tx_check_gop(struct xen_netbk *netbk,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 67/81] tcp: frto should not set snd_cwnd to 0

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Eric Dumazet eduma...@google.com

commit 2e5f421211ff76c17130b4597bc06df4eeead24f upstream.

Commit 9dc274151a548 (tcp: fix ABC in tcp_slow_start())
uncovered a bug in FRTO code :
tcp_process_frto() is setting snd_cwnd to 0 if the number
of in flight packets is 0.

As Neal pointed out, if no packet is in flight we lost our
chance to disambiguate whether a loss timeout was spurious.

We should assume it was a proper loss.

Reported-by: Pasi Kärkkäinen pa...@iki.fi
Signed-off-by: Neal Cardwell ncardw...@google.com
Signed-off-by: Eric Dumazet eduma...@google.com
Cc: Ilpo Järvinen ilpo.jarvi...@helsinki.fi
Cc: Yuchung Cheng ych...@google.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 net/ipv4/tcp_input.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 19c430c..6affa92 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3695,7 +3695,8 @@ static bool tcp_process_frto(struct sock *sk, int flag)
((tp-frto_counter = 2)  (flag  FLAG_RETRANS_DATA_ACKED)))
tp-undo_marker = 0;
 
-   if (!before(tp-snd_una, tp-frto_highmark)) {
+   if (!before(tp-snd_una, tp-frto_highmark) ||
+   !tcp_packets_in_flight(tp)) {
tcp_enter_frto_loss(sk, (tp-frto_counter == 1 ? 2 : 3), flag);
return true;
}
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 70/81] tg3: Avoid null pointer dereference in tg3_interrupt in netconsole mode

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Nithin Nayak Sujir nsu...@broadcom.com

commit 9c13cb8bb477a83b9a3c9e5a5478a4e21294a760 upstream.

When netconsole is enabled, logging messages generated during tg3_open
can result in a null pointer dereference for the uninitialized tg3
status block. Use the irq_sync flag to disable polling in the early
stages. irq_sync is cleared when the driver is enabling interrupts after
all initialization is completed.

Signed-off-by: Nithin Nayak Sujir nsu...@broadcom.com
Signed-off-by: Michael Chan mc...@broadcom.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/ethernet/broadcom/tg3.c |4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/tg3.c 
b/drivers/net/ethernet/broadcom/tg3.c
index 15f8b00..82a8ed2 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -6594,6 +6594,9 @@ static void tg3_poll_controller(struct net_device *dev)
int i;
struct tg3 *tp = netdev_priv(dev);
 
+   if (tg3_irq_sync(tp))
+   return;
+
for (i = 0; i  tp-irq_cnt; i++)
tg3_interrupt(tp-napi[i].irq_vec, tp-napi[i]);
 }
@@ -15556,6 +15559,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
tp-pm_cap = pm_cap;
tp-rx_mode = TG3_DEF_RX_MODE;
tp-tx_mode = TG3_DEF_TX_MODE;
+   tp-irq_sync = 1;
 
if (tg3_debug  0)
tp-msg_enable = tg3_debug;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 73/81] s390/timer: avoid overflow when programming clock comparator

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Heiko Carstens heiko.carst...@de.ibm.com

commit d911e03d097bdc01363df5d81c43f69432eb785c upstream.

Since ed4f209 s390/time: fix sched_clock() overflow a new helper function
is used to avoid overflows when converting TOD format values to nanosecond
values.
The kvm interrupt code formerly however only worked by accident because of
an overflow. It tried to program a timer that would expire in more than ~29
years. Because of the old TOD-to-nanoseconds overflow bug the real expiry
value however was much smaller, but now it isn't anymore.
This however triggers yet another bug in the function that programs the clock
comparator s390_next_ktime(): if the absolute expires value is after 2042
this will result in an overflow and the programmed value is lower than the
current TOD value which immediatly triggers a clock comparator (= timer)
interrupt.
Since the timer isn't expired it will be programmed immediately again and so
on... the result is a dead system.
To fix this simply program the maximum possible value if an overflow is
detected.

Reported-by: Christian Borntraeger borntrae...@de.ibm.com
Tested-by: Christian Borntraeger borntrae...@de.ibm.com
Signed-off-by: Heiko Carstens heiko.carst...@de.ibm.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 arch/s390/kernel/time.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index c5531db..747ab28 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -121,6 +121,9 @@ static int s390_next_ktime(ktime_t expires,
nsecs = ktime_to_ns(ktime_add(timespec_to_ktime(ts), expires));
do_div(nsecs, 125);
S390_lowcore.clock_comparator = sched_clock_base_cc + (nsecs  9);
+   /* Program the maximum value if we have an overflow (== year 2042) */
+   if (unlikely(S390_lowcore.clock_comparator  sched_clock_base_cc))
+   S390_lowcore.clock_comparator = -1ULL;
set_clock_comparator(S390_lowcore.clock_comparator);
return 0;
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 74/81] x86: Do not leak kernel page mapping locations

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Kees Cook keesc...@chromium.org

commit e575a86fdc50d013bf3ad3aa81d9100e8e6cc60d upstream.

Without this patch, it is trivial to determine kernel page
mappings by examining the error code reported to dmesg[1].
Instead, declare the entire kernel memory space as a violation
of a present page.

Additionally, since show_unhandled_signals is enabled by
default, switch branch hinting to the more realistic
expectation, and unobfuscate the setting of the PF_PROT bit to
improve readability.

[1] http://vulnfactory.org/blog/2013/02/06/a-linux-memory-trick/

Reported-by: Dan Rosenberg dan.j.rosenb...@gmail.com
Suggested-by: Brad Spengler spen...@grsecurity.net
Signed-off-by: Kees Cook keesc...@chromium.org
Acked-by: H. Peter Anvin h...@zytor.com
Cc: Paul E. McKenney paul...@linux.vnet.ibm.com
Cc: Frederic Weisbecker fweis...@gmail.com
Cc: Eric W. Biederman ebied...@xmission.com
Cc: Linus Torvalds torva...@linux-foundation.org
Cc: Andrew Morton a...@linux-foundation.org
Cc: Peter Zijlstra a.p.zijls...@chello.nl
Link: http://lkml.kernel.org/r/20130207174413.ga12...@www.outflux.net
Signed-off-by: Ingo Molnar mi...@kernel.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 arch/x86/mm/fault.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 76dcd9d..c6b10e2 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -747,13 +747,15 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned 
long error_code,
return;
}
 #endif
+   /* Kernel addresses are always protection faults: */
+   if (address = TASK_SIZE)
+   error_code |= PF_PROT;
 
-   if (unlikely(show_unhandled_signals))
+   if (likely(show_unhandled_signals))
show_signal_msg(regs, error_code, address, tsk);
 
-   /* Kernel addresses are always protection faults: */
tsk-thread.cr2 = address;
-   tsk-thread.error_code  = error_code | (address = TASK_SIZE);
+   tsk-thread.error_code  = error_code;
tsk-thread.trap_nr = X86_TRAP_PF;
 
force_sig_info_fault(SIGSEGV, si_code, address, tsk, 0);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 76/81] drivers/rtc/rtc-pl031.c: restore ST variant functionality

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Linus Walleij linus.wall...@linaro.org

commit 3399cfb5df9594495b876d1843a7165f77366b2b upstream.

Commit e7e034e18a0a (drivers/rtc/rtc-pl031.c: fix the missing operation
on enable) accidentally broke the ST variants of PL031.

The bit that is being poked as clockwatch enable bit for the ST
variants does the work of bit 0 on this variant.  Bit 0 is used for a
clock divider on the ST variants, and setting it to 1 will affect
timekeeping in a very bad way.

Signed-off-by: Linus Walleij linus.wall...@linaro.org
Acked-by: Haojian Zhuang haojian.zhu...@gmail.com
Cc: Mian Yousaf KAUKAB mian.yousaf.kau...@stericsson.com
Cc: Srinidhi Kasagar srinidhi.kasa...@stericsson.com
Cc: Alessandro Zummo a.zu...@towertech.it
Signed-off-by: Andrew Morton a...@linux-foundation.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/rtc/rtc-pl031.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index c42054b..b232996 100644
--- a/drivers/rtc/rtc-pl031.c
+++ b/drivers/rtc/rtc-pl031.c
@@ -336,7 +336,9 @@ static int pl031_probe(struct amba_device *adev, const 
struct amba_id *id)
/* Enable the clockwatch on ST Variants */
if (ldata-hw_designer == AMBA_VENDOR_ST)
data |= RTC_CR_CWEN;
-   writel(data | RTC_CR_EN, ldata-base + RTC_CR);
+   else
+   data |= RTC_CR_EN;
+   writel(data, ldata-base + RTC_CR);
 
/*
 * On ST PL031 variants, the RTC reset value does not provide correct
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 79/81] PCI/PM: Clean up PME state when removing a device

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Rafael J. Wysocki r...@sisk.pl

commit 249bfb83cf8ba658955f0245ac3981d941f746ee upstream.

Devices are added to pci_pme_list when drivers use pci_enable_wake()
or pci_wake_from_d3(), but they aren't removed from the list unless
the driver explicitly disables wakeup.  Many drivers never disable
wakeup, so their devices remain on the list even after they are
removed, e.g., via hotplug.  A subsequent PME poll will oops when
it tries to touch the device.

This patch disables PME# on a device before removing it, which removes
the device from pci_pme_list.  This is safe even if the device never
had PME# enabled.

This oops can be triggered by unplugging a Thunderbolt ethernet adapter
on a Macbook Pro, as reported by Daniel below.

[bhelgaas: changelog]
Reference: 
http://lkml.kernel.org/r/camvg2svg21yim1wkh4_2pen2n+cr2-zv7tbh3gj+8mwevzj...@mail.gmail.com
Reported-and-tested-by: Daniel J Blueman dan...@quora.org
Signed-off-by: Rafael J. Wysocki rafael.j.wyso...@intel.com
Signed-off-by: Bjorn Helgaas bhelg...@google.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/pci/remove.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
index fd77e2b..eae55c7 100644
--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -19,6 +19,8 @@ static void pci_free_resources(struct pci_dev *dev)
 
 static void pci_stop_dev(struct pci_dev *dev)
 {
+   pci_pme_active(dev, false);
+
if (dev-is_added) {
pci_proc_detach_device(dev);
pci_remove_sysfs_dev_files(dev);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 81/81] mm: fix pageblock bitmap allocation

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Linus Torvalds torva...@linux-foundation.org

commit 7c45512df987c5619db041b5c9b80d281e26d3db upstream.

Commit c060f943d092 (mm: use aligned zone start for pfn_to_bitidx
calculation) fixed out calculation of the index into the pageblock
bitmap when a !SPARSEMEM zome was not aligned to pageblock_nr_pages.

However, the _allocation_ of that bitmap had never taken this alignment
requirement into accout, so depending on the exact size and alignment of
the zone, the use of that index could then access past the allocation,
resulting in some very subtle memory corruption.

This was reported (and bisected) by Ingo Molnar: one of his random
config builds would hang with certain very specific kernel command line
options.

In the meantime, commit c060f943d092 has been marked for stable, so this
fix needs to be back-ported to the stable kernels that backported the
commit to use the right alignment.

Bisected-and-tested-by: Ingo Molnar mi...@kernel.org
Acked-by: Mel Gorman mgor...@suse.de
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 mm/page_alloc.c |   15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 007bf3b..0ed96c7 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4272,10 +4272,11 @@ static void __meminit calculate_node_totalpages(struct 
pglist_data *pgdat,
  * round what is now in bits to nearest long in bits, then return it in
  * bytes.
  */
-static unsigned long __init usemap_size(unsigned long zonesize)
+static unsigned long __init usemap_size(unsigned long zone_start_pfn, unsigned 
long zonesize)
 {
unsigned long usemapsize;
 
+   zonesize += zone_start_pfn  (pageblock_nr_pages-1);
usemapsize = roundup(zonesize, pageblock_nr_pages);
usemapsize = usemapsize  pageblock_order;
usemapsize *= NR_PAGEBLOCK_BITS;
@@ -4285,17 +4286,19 @@ static unsigned long __init usemap_size(unsigned long 
zonesize)
 }
 
 static void __init setup_usemap(struct pglist_data *pgdat,
-   struct zone *zone, unsigned long zonesize)
+   struct zone *zone,
+   unsigned long zone_start_pfn,
+   unsigned long zonesize)
 {
-   unsigned long usemapsize = usemap_size(zonesize);
+   unsigned long usemapsize = usemap_size(zone_start_pfn, zonesize);
zone-pageblock_flags = NULL;
if (usemapsize)
zone-pageblock_flags = alloc_bootmem_node_nopanic(pgdat,
   usemapsize);
 }
 #else
-static inline void setup_usemap(struct pglist_data *pgdat,
-   struct zone *zone, unsigned long zonesize) {}
+static inline void setup_usemap(struct pglist_data *pgdat, struct zone *zone,
+   unsigned long zone_start_pfn, unsigned long 
zonesize) {}
 #endif /* CONFIG_SPARSEMEM */
 
 #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE
@@ -4414,7 +4417,7 @@ static void __paginginit free_area_init_core(struct 
pglist_data *pgdat,
continue;
 
set_pageblock_order();
-   setup_usemap(pgdat, zone, size);
+   setup_usemap(pgdat, zone, zone_start_pfn, size);
ret = init_currently_empty_zone(zone, zone_start_pfn,
size, MEMMAP_EARLY);
BUG_ON(ret);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 80/81] efi: Clear EFI_RUNTIME_SERVICES rather than EFI_BOOT by noefi boot parameter

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Satoru Takeuchi takeuchi_sat...@jp.fujitsu.com

commit 1de63d60cd5b0d33a812efa455d5933bf1564a51 upstream.

There was a serious problem in samsung-laptop that its platform driver is
designed to run under BIOS and running under EFI can cause the machine to
become bricked or can cause Machine Check Exceptions.

Discussion about this problem:
https://bugs.launchpad.net/ubuntu-cdimage/+bug/1040557
https://bugzilla.kernel.org/show_bug.cgi?id=47121

The patches to fix this problem:
efi: Make 'efi_enabled' a function to query EFI facilities
83e68189745ad931c2afd45d8ee3303929233e7f

samsung-laptop: Disable on EFI hardware
e0094244e41c4d0c7ad69920681972fc45d8ce34

Unfortunately this problem comes back again if users specify noefi option.
This parameter clears EFI_BOOT and that driver continues to run even if running
under EFI. Refer to the document, this parameter should clear
EFI_RUNTIME_SERVICES instead.

Documentation/kernel-parameters.txt:
===
...
noefi   [X86] Disable EFI runtime services support.
...
===

Documentation/x86/x86_64/uefi.txt:
===
...
- If some or all EFI runtime services don't work, you can try following
  kernel command line parameters to turn off some or all EFI runtime
  services.
noefi   turn off all EFI runtime services
...
===

Signed-off-by: Satoru Takeuchi takeuchi_sat...@jp.fujitsu.com
Link: http://lkml.kernel.org/r/511c2c04.2070...@jp.fujitsu.com
Cc: Matt Fleming matt.flem...@intel.com
Signed-off-by: H. Peter Anvin h...@linux.intel.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 arch/x86/platform/efi/efi.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 6fcd4ad..3705bb0 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -86,7 +86,7 @@ EXPORT_SYMBOL(efi_enabled);
 
 static int __init setup_noefi(char *arg)
 {
-   clear_bit(EFI_BOOT, x86_efi_facility);
+   clear_bit(EFI_RUNTIME_SERVICES, x86_efi_facility);
return 0;
 }
 early_param(noefi, setup_noefi);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 78/81] x86/mm: Check if PUD is large when validating a kernel address

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Mel Gorman mgor...@suse.de

commit 0ee364eb316348ddf3e0dfcd986f5f13f528f821 upstream.

A user reported the following oops when a backup process reads
/proc/kcore:

 BUG: unable to handle kernel paging request at bb00ff33b000
 IP: [8103157e] kern_addr_valid+0xbe/0x110
 [...]

 Call Trace:
  [811b8aaa] read_kcore+0x17a/0x370
  [811ad847] proc_reg_read+0x77/0xc0
  [81151687] vfs_read+0xc7/0x130
  [811517f3] sys_read+0x53/0xa0
  [81449692] system_call_fastpath+0x16/0x1b

Investigation determined that the bug triggered when reading
system RAM at the 4G mark. On this system, that was the first
address using 1G pages for the virt-phys direct mapping so the
PUD is pointing to a physical address, not a PMD page.

The problem is that the page table walker in kern_addr_valid() is
not checking pud_large() and treats the physical address as if
it was a PMD.  If it happens to look like pmd_none then it'll
silently fail, probably returning zeros instead of real data. If
the data happens to look like a present PMD though, it will be
walked resulting in the oops above.

This patch adds the necessary pud_large() check.

Unfortunately the problem was not readily reproducible and now
they are running the backup program without accessing
/proc/kcore so the patch has not been validated but I think it
makes sense.

Signed-off-by: Mel Gorman mgor...@suse.de
Reviewed-by: Rik van Riel r...@redhat.com
Reviewed-by: Michal Hocko mho...@suse.cz
Acked-by: Johannes Weiner han...@cmpxchg.org
Cc: linux...@kvack.org
Link: http://lkml.kernel.org/r/20130211145236.gx21...@suse.de
Signed-off-by: Ingo Molnar mi...@kernel.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 arch/x86/include/asm/pgtable.h |5 +
 arch/x86/mm/init_64.c  |3 +++
 2 files changed, 8 insertions(+)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index c3520d7..3f3dd52 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -142,6 +142,11 @@ static inline unsigned long pmd_pfn(pmd_t pmd)
return (pmd_val(pmd)  PTE_PFN_MASK)  PAGE_SHIFT;
 }
 
+static inline unsigned long pud_pfn(pud_t pud)
+{
+   return (pud_val(pud)  PTE_PFN_MASK)  PAGE_SHIFT;
+}
+
 #define pte_page(pte)  pfn_to_page(pte_pfn(pte))
 
 static inline int pmd_large(pmd_t pte)
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 3baff25..ce42da7 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -829,6 +829,9 @@ int kern_addr_valid(unsigned long addr)
if (pud_none(*pud))
return 0;
 
+   if (pud_large(*pud))
+   return pfn_valid(pud_pfn(*pud));
+
pmd = pmd_offset(pud, addr);
if (pmd_none(*pmd))
return 0;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 77/81] mm: don't overwrite mm-def_flags in do_mlockall()

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Gerald Schaefer gerald.schae...@de.ibm.com

commit 9977f0f164d46613288e0b5778eae500dfe06f31 upstream.

With commit 8e72033f2a48 (thp: make MADV_HUGEPAGE check for
mm-def_flags) the VM_NOHUGEPAGE flag may be set on s390 in
mm-def_flags for certain processes, to prevent future thp mappings.
This would be overwritten by do_mlockall(), which sets it back to 0 with
an optional VM_LOCKED flag set.

To fix this, instead of overwriting mm-def_flags in do_mlockall(), only
the VM_LOCKED flag should be set or cleared.

Signed-off-by: Gerald Schaefer gerald.schae...@de.ibm.com
Reported-by: Vivek Goyal vgo...@redhat.com
Cc: Andrea Arcangeli aarca...@redhat.com
Cc: Hugh Dickins hu...@google.com
Cc: Martin Schwidefsky schwidef...@de.ibm.com
Cc: Heiko Carstens heiko.carst...@de.ibm.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 mm/mlock.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/mlock.c b/mm/mlock.c
index ef726e8..3283272 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -524,11 +524,11 @@ SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, 
len)
 static int do_mlockall(int flags)
 {
struct vm_area_struct * vma, * prev = NULL;
-   unsigned int def_flags = 0;
 
if (flags  MCL_FUTURE)
-   def_flags = VM_LOCKED;
-   current-mm-def_flags = def_flags;
+   current-mm-def_flags |= VM_LOCKED;
+   else
+   current-mm-def_flags = ~VM_LOCKED;
if (flags == MCL_FUTURE)
goto out;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 63/81] xen/netback: shutdown the ring if it contains garbage.

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Ian Campbell ian.campb...@citrix.com

commit 48856286b64e4b66ec62b94e504d0b29c1ade664 upstream.

A buggy or malicious frontend should not be able to confuse netback.
If we spot anything which is not as it should be then shutdown the
device and don't try to continue with the ring in a potentially
hostile state. Well behaved and non-hostile frontends will not be
penalised.

As well as making the existing checks for such errors fatal also add a
new check that ensures that there isn't an insane number of requests
on the ring (i.e. more than would fit in the ring). If the ring
contains garbage then previously is was possible to loop over this
insane number, getting an error each time and therefore not generating
any more pending requests and therefore not exiting the loop in
xen_netbk_tx_build_gops for an externded period.

Also turn various netdev_dbg calls which no precipitate a fatal error
into netdev_err, they are rate limited because the device is shutdown
afterwards.

This fixes at least one known DoS/softlockup of the backend domain.

Signed-off-by: Ian Campbell ian.campb...@citrix.com
Reviewed-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com
Acked-by: Jan Beulich jbeul...@suse.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/xen-netback/common.h|3 ++
 drivers/net/xen-netback/interface.c |   23 -
 drivers/net/xen-netback/netback.c   |   62 +--
 3 files changed, 62 insertions(+), 26 deletions(-)

diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
index 94b79c3..9d7f172 100644
--- a/drivers/net/xen-netback/common.h
+++ b/drivers/net/xen-netback/common.h
@@ -151,6 +151,9 @@ void xen_netbk_queue_tx_skb(struct xenvif *vif, struct 
sk_buff *skb);
 /* Notify xenvif that ring now has space to send an skb to the frontend */
 void xenvif_notify_tx_completion(struct xenvif *vif);
 
+/* Prevent the device from generating any further traffic. */
+void xenvif_carrier_off(struct xenvif *vif);
+
 /* Returns number of ring slots required to send an skb to the frontend */
 unsigned int xen_netbk_count_skb_slots(struct xenvif *vif, struct sk_buff 
*skb);
 
diff --git a/drivers/net/xen-netback/interface.c 
b/drivers/net/xen-netback/interface.c
index b7d41f8..b8c5193 100644
--- a/drivers/net/xen-netback/interface.c
+++ b/drivers/net/xen-netback/interface.c
@@ -343,17 +343,22 @@ err:
return err;
 }
 
-void xenvif_disconnect(struct xenvif *vif)
+void xenvif_carrier_off(struct xenvif *vif)
 {
struct net_device *dev = vif-dev;
-   if (netif_carrier_ok(dev)) {
-   rtnl_lock();
-   netif_carrier_off(dev); /* discard queued packets */
-   if (netif_running(dev))
-   xenvif_down(vif);
-   rtnl_unlock();
-   xenvif_put(vif);
-   }
+
+   rtnl_lock();
+   netif_carrier_off(dev); /* discard queued packets */
+   if (netif_running(dev))
+   xenvif_down(vif);
+   rtnl_unlock();
+   xenvif_put(vif);
+}
+
+void xenvif_disconnect(struct xenvif *vif)
+{
+   if (netif_carrier_ok(vif-dev))
+   xenvif_carrier_off(vif);
 
atomic_dec(vif-refcnt);
wait_event(vif-waiting_to_free, atomic_read(vif-refcnt) == 0);
diff --git a/drivers/net/xen-netback/netback.c 
b/drivers/net/xen-netback/netback.c
index f4a6fca..ae321c0 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -859,6 +859,13 @@ static void netbk_tx_err(struct xenvif *vif,
xenvif_put(vif);
 }
 
+static void netbk_fatal_tx_err(struct xenvif *vif)
+{
+   netdev_err(vif-dev, fatal error; disabling device\n);
+   xenvif_carrier_off(vif);
+   xenvif_put(vif);
+}
+
 static int netbk_count_requests(struct xenvif *vif,
struct xen_netif_tx_request *first,
struct xen_netif_tx_request *txp,
@@ -872,19 +879,22 @@ static int netbk_count_requests(struct xenvif *vif,
 
do {
if (frags = work_to_do) {
-   netdev_dbg(vif-dev, Need more frags\n);
+   netdev_err(vif-dev, Need more frags\n);
+   netbk_fatal_tx_err(vif);
return -frags;
}
 
if (unlikely(frags = MAX_SKB_FRAGS)) {
-   netdev_dbg(vif-dev, Too many frags\n);
+   netdev_err(vif-dev, Too many frags\n);
+   netbk_fatal_tx_err(vif);
return -frags;
}
 
memcpy(txp, RING_GET_REQUEST(vif-tx, cons + frags),
   sizeof(*txp));
if (txp-size  first-size) {
-   netdev_dbg(vif-dev, Frags galore\n

[PATCH 71/81] tg3: Fix crc errors on jumbo frame receive

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Nithin Nayak Sujir nsu...@broadcom.com

commit daf3ec688e057f6060fb9bb0819feac7a8bbf45c upstream.

TG3_PHY_AUXCTL_SMDSP_ENABLE/DISABLE macros do a blind write to the phy
auxiliary control register and overwrite the EXT_PKT_LEN (bit 14) resulting
in intermittent crc errors on jumbo frames with some link partners. Change
the code to do a read/modify/write.

Signed-off-by: Nithin Nayak Sujir nsu...@broadcom.com
Signed-off-by: Michael Chan mc...@broadcom.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/ethernet/broadcom/tg3.c |   58 +--
 1 file changed, 35 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c 
b/drivers/net/ethernet/broadcom/tg3.c
index 82a8ed2..4da6a86 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -1136,14 +1136,26 @@ static int tg3_phy_auxctl_write(struct tg3 *tp, int 
reg, u32 set)
return tg3_writephy(tp, MII_TG3_AUX_CTRL, set | reg);
 }
 
-#define TG3_PHY_AUXCTL_SMDSP_ENABLE(tp) \
-   tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL, \
-MII_TG3_AUXCTL_ACTL_SMDSP_ENA | \
-MII_TG3_AUXCTL_ACTL_TX_6DB)
+static int tg3_phy_toggle_auxctl_smdsp(struct tg3 *tp, bool enable)
+{
+   u32 val;
+   int err;
+
+   err = tg3_phy_auxctl_read(tp, MII_TG3_AUXCTL_SHDWSEL_AUXCTL, val);
 
-#define TG3_PHY_AUXCTL_SMDSP_DISABLE(tp) \
-   tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL, \
-MII_TG3_AUXCTL_ACTL_TX_6DB);
+   if (err)
+   return err;
+   if (enable)
+
+   val |= MII_TG3_AUXCTL_ACTL_SMDSP_ENA;
+   else
+   val = ~MII_TG3_AUXCTL_ACTL_SMDSP_ENA;
+
+   err = tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL,
+  val | MII_TG3_AUXCTL_ACTL_TX_6DB);
+
+   return err;
+}
 
 static int tg3_bmcr_reset(struct tg3 *tp)
 {
@@ -2076,7 +2088,7 @@ static void tg3_phy_apply_otp(struct tg3 *tp)
 
otp = tp-phy_otp;
 
-   if (TG3_PHY_AUXCTL_SMDSP_ENABLE(tp))
+   if (tg3_phy_toggle_auxctl_smdsp(tp, true))
return;
 
phy = ((otp  TG3_OTP_AGCTGT_MASK)  TG3_OTP_AGCTGT_SHIFT);
@@ -2101,7 +2113,7 @@ static void tg3_phy_apply_otp(struct tg3 *tp)
  ((otp  TG3_OTP_RCOFF_MASK)  TG3_OTP_RCOFF_SHIFT);
tg3_phydsp_write(tp, MII_TG3_DSP_EXP97, phy);
 
-   TG3_PHY_AUXCTL_SMDSP_DISABLE(tp);
+   tg3_phy_toggle_auxctl_smdsp(tp, false);
 }
 
 static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up)
@@ -2137,9 +2149,9 @@ static void tg3_phy_eee_adjust(struct tg3 *tp, u32 
current_link_up)
 
if (!tp-setlpicnt) {
if (current_link_up == 1 
-  !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) {
+  !tg3_phy_toggle_auxctl_smdsp(tp, true)) {
tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, 0x);
-   TG3_PHY_AUXCTL_SMDSP_DISABLE(tp);
+   tg3_phy_toggle_auxctl_smdsp(tp, false);
}
 
val = tr32(TG3_CPMU_EEE_MODE);
@@ -2155,11 +2167,11 @@ static void tg3_phy_eee_enable(struct tg3 *tp)
(GET_ASIC_REV(tp-pci_chip_rev_id) == ASIC_REV_5717 ||
 GET_ASIC_REV(tp-pci_chip_rev_id) == ASIC_REV_5719 ||
 tg3_flag(tp, 57765_CLASS)) 
-   !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) {
+   !tg3_phy_toggle_auxctl_smdsp(tp, true)) {
val = MII_TG3_DSP_TAP26_ALNOKO |
  MII_TG3_DSP_TAP26_RMRXSTO;
tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, val);
-   TG3_PHY_AUXCTL_SMDSP_DISABLE(tp);
+   tg3_phy_toggle_auxctl_smdsp(tp, false);
}
 
val = tr32(TG3_CPMU_EEE_MODE);
@@ -2303,7 +2315,7 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
tg3_writephy(tp, MII_CTRL1000,
 CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER);
 
-   err = TG3_PHY_AUXCTL_SMDSP_ENABLE(tp);
+   err = tg3_phy_toggle_auxctl_smdsp(tp, true);
if (err)
return err;
 
@@ -2324,7 +2336,7 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8200);
tg3_writephy(tp, MII_TG3_DSP_CONTROL, 0x);
 
-   TG3_PHY_AUXCTL_SMDSP_DISABLE(tp);
+   tg3_phy_toggle_auxctl_smdsp(tp, false);
 
tg3_writephy(tp, MII_CTRL1000, phy9_orig);
 
@@ -2413,10 +2425,10 @@ static int tg3_phy_reset(struct tg3 *tp)
 
 out:
if ((tp-phy_flags  TG3_PHYFLG_ADC_BUG) 
-   !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) {
+   !tg3_phy_toggle_auxctl_smdsp(tp, true)) {
tg3_phydsp_write(tp, 0x201f, 0x2aaa

[PATCH 75/81] x86/apic: Work around boot failure on HP ProLiant DL980 G7 Server systems

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Stoney Wang song-bo.w...@hp.com

commit cb214ede7657db458fd0b2a25ea0b28dbf900ebc upstream.

When a HP ProLiant DL980 G7 Server boots a regular kernel,
there will be intermittent lost interrupts which could
result in a hang or (in extreme cases) data loss.

The reason is that this system only supports x2apic physical
mode, while the kernel boots with a logical-cluster default
setting.

This bug can be worked around by specifying the x2apic_phys or
nox2apic boot option, but we want to handle this system
without requiring manual workarounds.

The BIOS sets ACPI_FADT_APIC_PHYSICAL in FADT table.
As all apicids are smaller than 255, BIOS need to pass the
control to the OS with xapic mode, according to x2apic-spec,
chapter 2.9.

Current code handle x2apic when BIOS pass with xapic mode
enabled:

When user specifies x2apic_phys, or FADT indicates PHYSICAL:

1. During madt oem check, apic driver is set with xapic logical
   or xapic phys driver at first.

2. enable_IR_x2apic() will enable x2apic_mode.

3. if user specifies x2apic_phys on the boot line, x2apic_phys_probe()
   will install the correct x2apic phys driver and use x2apic phys mode.
   Otherwise it will skip the driver will let x2apic_cluster_probe to
   take over to install x2apic cluster driver (wrong one) even though FADT
   indicates PHYSICAL, because x2apic_phys_probe does not check
   FADT PHYSICAL.

Add checking x2apic_fadt_phys in x2apic_phys_probe() to fix the
problem.

Signed-off-by: Stoney Wang song-bo.w...@hp.com
[ updated the changelog and simplified the code ]
Signed-off-by: Yinghai Lu ying...@kernel.org
Link: 
http://lkml.kernel.org/r/1360263182-16226-1-git-send-email-ying...@kernel.org
Signed-off-by: Ingo Molnar mi...@kernel.org
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 arch/x86/kernel/apic/x2apic_phys.c |   21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/arch/x86/kernel/apic/x2apic_phys.c 
b/arch/x86/kernel/apic/x2apic_phys.c
index c17e982..d14fee3 100644
--- a/arch/x86/kernel/apic/x2apic_phys.c
+++ b/arch/x86/kernel/apic/x2apic_phys.c
@@ -20,18 +20,19 @@ static int set_x2apic_phys_mode(char *arg)
 }
 early_param(x2apic_phys, set_x2apic_phys_mode);
 
-static int x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+static bool x2apic_fadt_phys(void)
 {
-   if (x2apic_phys)
-   return x2apic_enabled();
-   else if ((acpi_gbl_FADT.header.revision = FADT2_REVISION_ID) 
-   (acpi_gbl_FADT.flags  ACPI_FADT_APIC_PHYSICAL) 
-   x2apic_enabled()) {
+   if ((acpi_gbl_FADT.header.revision = FADT2_REVISION_ID) 
+   (acpi_gbl_FADT.flags  ACPI_FADT_APIC_PHYSICAL)) {
printk(KERN_DEBUG System requires x2apic physical mode\n);
-   return 1;
+   return true;
}
-   else
-   return 0;
+   return false;
+}
+
+static int x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+{
+   return x2apic_enabled()  (x2apic_phys || x2apic_fadt_phys());
 }
 
 static void
@@ -114,7 +115,7 @@ static void init_x2apic_ldr(void)
 
 static int x2apic_phys_probe(void)
 {
-   if (x2apic_mode  x2apic_phys)
+   if (x2apic_mode  (x2apic_phys || x2apic_fadt_phys()))
return 1;
 
return apic == apic_x2apic_phys;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 72/81] Revert USB: Handle warm reset failure on empty port.

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com

This reverts commit ff88c5021f17139d961478e40372f6bb028321bc, which is a
cherry-pick of commit 65bdac5effd15d6af619b3b7218627ef4d84ed6a upstream.

As discussed on a recent thread on stable/lkml/etc. ([regression]
external HDD in USB3 enclosure cannot be dynamically removed), this
changed caused issues, and shall be reapplied later with the proper
fixes, once they go into Linus tree.

Cc: Sarah Sharp sarah.a.sh...@linux.intel.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/usb/core/hub.c |   12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index c9590c6..1e8b3bd 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2488,11 +2488,6 @@ static int hub_port_wait_reset(struct usb_hub *hub, int 
port1,
return 0;
}
} else {
-   if (!(portstatus  USB_PORT_STAT_CONNECTION) ||
-   hub_port_warm_reset_required(hub,
-   portstatus))
-   return -ENOTCONN;
-
return 0;
}
 
@@ -4537,14 +4532,9 @@ static void hub_events(void)
 * SS.Inactive state.
 */
if (hub_port_warm_reset_required(hub, portstatus)) {
-   int status;
-
dev_dbg(hub_dev, warm reset port %d\n, i);
-   status = hub_port_reset(hub, i, NULL,
+   hub_port_reset(hub, i, NULL,
HUB_BH_RESET_TIME, true);
-   if (status  0)
-   hub_port_disable(hub, i, 1);
-   connect_change = 0;
}
 
if (connect_change)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 69/81] bridge: Pull ip header into skb-data before looking into ip header.

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Sarveshwar Bandi sarveshwar.ba...@emulex.com

commit 6caab7b0544e83e6c160b5e80f5a4a7dd69545c7 upstream.

If lower layer driver leaves the ip header in the skb fragment, it needs to
be first pulled into skb-data before inspecting ip header length or ip version
number.

Signed-off-by: Sarveshwar Bandi sarveshwar.ba...@emulex.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 net/bridge/br_netfilter.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index e41456b..ab52468 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -256,6 +256,9 @@ static int br_parse_ip_options(struct sk_buff *skb)
struct net_device *dev = skb-dev;
u32 len;
 
+   if (!pskb_may_pull(skb, sizeof(struct iphdr)))
+   goto inhdr_error;
+
iph = ip_hdr(skb);
opt = (IPCB(skb)-opt);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 68/81] tcp: fix for zero packets_in_flight was too broad

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= ilpo.jarvi...@helsinki.fi

commit 6731d2095bd4aef18027c72ef845ab1087c3ba63 upstream.

There are transients during normal FRTO procedure during which
the packets_in_flight can go to zero between write_queue state
updates and firing the resulting segments out. As FRTO processing
occurs during that window the check must be more precise to
not match spuriously :-). More specificly, e.g., when
packets_in_flight is zero but FLAG_DATA_ACKED is true the problematic
branch that set cwnd into zero would not be taken and new segments
might be sent out later.

Signed-off-by: Ilpo Järvinen ilpo.jarvi...@helsinki.fi
Tested-by: Eric Dumazet eduma...@google.com
Acked-by: Neal Cardwell ncardw...@google.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 net/ipv4/tcp_input.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 6affa92..3b14d81 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3695,8 +3695,7 @@ static bool tcp_process_frto(struct sock *sk, int flag)
((tp-frto_counter = 2)  (flag  FLAG_RETRANS_DATA_ACKED)))
tp-undo_marker = 0;
 
-   if (!before(tp-snd_una, tp-frto_highmark) ||
-   !tcp_packets_in_flight(tp)) {
+   if (!before(tp-snd_una, tp-frto_highmark)) {
tcp_enter_frto_loss(sk, (tp-frto_counter == 1 ? 2 : 3), flag);
return true;
}
@@ -3716,6 +3715,11 @@ static bool tcp_process_frto(struct sock *sk, int flag)
}
} else {
if (!(flag  FLAG_DATA_ACKED)  (tp-frto_counter == 1)) {
+   if (!tcp_packets_in_flight(tp)) {
+   tcp_enter_frto_loss(sk, 2, flag);
+   return true;
+   }
+
/* Prevent sending of new data. */
tp-snd_cwnd = min(tp-snd_cwnd,
   tcp_packets_in_flight(tp));
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 66/81] netback: correct netbk_tx_err to handle wrap around.

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Ian Campbell ian.campb...@citrix.com

commit b9149729ebdcfce63f853aa54a404c6a8f6ebbf3 upstream.

Signed-off-by: Ian Campbell ian.campb...@citrix.com
Acked-by: Jan Beulich jbeul...@suse.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/xen-netback/netback.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/xen-netback/netback.c 
b/drivers/net/xen-netback/netback.c
index c503a58..f3c3a68 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -851,7 +851,7 @@ static void netbk_tx_err(struct xenvif *vif,
 
do {
make_tx_response(vif, txp, XEN_NETIF_RSP_ERROR);
-   if (cons = end)
+   if (cons == end)
break;
txp = RING_GET_REQUEST(vif-tx, cons++);
} while (1);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 60/81] sctp: refactor sctp_outq_teardown to insure proper re-initalization

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Neil Horman nhor...@tuxdriver.com

commit 2f94aabd9f6c925d77aecb3ff020f1cc12ed8f86 upstream.

Jamie Parsons reported a problem recently, in which the re-initalization of an
association (The duplicate init case), resulted in a loss of receive window
space.  He tracked down the root cause to sctp_outq_teardown, which discarded
all the data on an outq during a re-initalization of the corresponding
association, but never reset the outq-outstanding_data field to zero.  I wrote,
and he tested this fix, which does a proper full re-initalization of the outq,
fixing this problem, and hopefully future proofing us from simmilar issues down
the road.

Signed-off-by: Neil Horman nhor...@tuxdriver.com
Reported-by: Jamie Parsons jamie.pars...@metaswitch.com
Tested-by: Jamie Parsons jamie.pars...@metaswitch.com
CC: Jamie Parsons jamie.pars...@metaswitch.com
CC: Vlad Yasevich vyasev...@gmail.com
CC: David S. Miller da...@davemloft.net
CC: net...@vger.kernel.org
Acked-by: Vlad Yasevich vyasev...@gmail.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 net/sctp/outqueue.c |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index a0fa19f..0716290 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -223,7 +223,7 @@ void sctp_outq_init(struct sctp_association *asoc, struct 
sctp_outq *q)
 
 /* Free the outqueue structure and any related pending chunks.
  */
-void sctp_outq_teardown(struct sctp_outq *q)
+static void __sctp_outq_teardown(struct sctp_outq *q)
 {
struct sctp_transport *transport;
struct list_head *lchunk, *temp;
@@ -276,8 +276,6 @@ void sctp_outq_teardown(struct sctp_outq *q)
sctp_chunk_free(chunk);
}
 
-   q-error = 0;
-
/* Throw away any leftover control chunks. */
list_for_each_entry_safe(chunk, tmp, q-control_chunk_list, list) {
list_del_init(chunk-list);
@@ -285,11 +283,17 @@ void sctp_outq_teardown(struct sctp_outq *q)
}
 }
 
+void sctp_outq_teardown(struct sctp_outq *q)
+{
+   __sctp_outq_teardown(q);
+   sctp_outq_init(q-asoc, q);
+}
+
 /* Free the outqueue structure and any related pending chunks.  */
 void sctp_outq_free(struct sctp_outq *q)
 {
/* Throw away leftover chunks. */
-   sctp_outq_teardown(q);
+   __sctp_outq_teardown(q);
 
/* If we were kmalloc()'d, free the memory.  */
if (q-malloced)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 62/81] net: sctp: sctp_endpoint_free: zero out secret key data

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Daniel Borkmann dbork...@redhat.com

commit b5c37fe6e24eec194bb29d22fdd55d73bcc709bf upstream.

On sctp_endpoint_destroy, previously used sensitive keying material
should be zeroed out before the memory is returned, as we already do
with e.g. auth keys when released.

Signed-off-by: Daniel Borkmann dbork...@redhat.com
Acked-by: Vlad Yasevich vyase...@redhat.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 net/sctp/endpointola.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index 68a385d..58cd035 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -248,6 +248,8 @@ void sctp_endpoint_free(struct sctp_endpoint *ep)
 /* Final destructor for endpoint.  */
 static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
 {
+   int i;
+
SCTP_ASSERT(ep-base.dead, Endpoint is not dead, return);
 
/* Free up the HMAC transform. */
@@ -270,6 +272,9 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
sctp_inq_free(ep-base.inqueue);
sctp_bind_addr_free(ep-base.bind_addr);
 
+   for (i = 0; i  SCTP_HOW_MANY_SECRETS; ++i)
+   memset(ep-secret_key[i], 0, SCTP_SECRET_SIZE);
+
/* Remove and free the port */
if (sctp_sk(ep-base.sk)-bind_hash)
sctp_put_port(ep-base.sk);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 58/81] packet: fix leakage of tx_ring memory

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Phil Sutter phil.sut...@viprinet.com

commit 9665d5d62487e8e7b1f546c00e11107155384b9a upstream.

When releasing a packet socket, the routine packet_set_ring() is reused
to free rings instead of allocating them. But when calling it for the
first time, it fills req-tp_block_nr with the value of rb-pg_vec_len
which in the second invocation makes it bail out since req-tp_block_nr
is greater zero but req-tp_block_size is zero.

This patch solves the problem by passing a zeroed auto-variable to
packet_set_ring() upon each invocation from packet_release().

As far as I can tell, this issue exists even since 69e3c75 (net: TX_RING
and packet mmap), i.e. the original inclusion of TX ring support into
af_packet, but applies only to sockets with both RX and TX ring
allocated, which is probably why this was unnoticed all the time.

Signed-off-by: Phil Sutter phil.sut...@viprinet.com
Cc: Johann Baudy johann.ba...@gnu-log.net
Cc: Daniel Borkmann dbork...@redhat.com
Acked-by: Daniel Borkmann dbork...@redhat.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 net/packet/af_packet.c |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 901cffd..02b1ef8 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2450,13 +2450,15 @@ static int packet_release(struct socket *sock)
 
packet_flush_mclist(sk);
 
-   memset(req_u, 0, sizeof(req_u));
-
-   if (po-rx_ring.pg_vec)
+   if (po-rx_ring.pg_vec) {
+   memset(req_u, 0, sizeof(req_u));
packet_set_ring(sk, req_u, 1, 0);
+   }
 
-   if (po-tx_ring.pg_vec)
+   if (po-tx_ring.pg_vec) {
+   memset(req_u, 0, sizeof(req_u));
packet_set_ring(sk, req_u, 1, 1);
+   }
 
fanout_release(sk);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 44/81] ipv6: fix the noflags test in addrconf_get_prefix_route

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Romain Kuntz r.ku...@ipflavors.com

commit 85da53bf1c336bb07ac038fb951403ab0478d2c5 upstream.

The tests on the flags in addrconf_get_prefix_route() does no make
much sense: the 'noflags' parameter contains the set of flags that
must not match with the route flags, so the test must be done
against 'noflags', and not against 'flags'.

Signed-off-by: Romain Kuntz r.ku...@ipflavors.com
Acked-by: YOSHIFUJI Hideaki yoshf...@linux-ipv6.org
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 net/ipv6/addrconf.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 0808ad5..fc9ac78 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1741,7 +1741,7 @@ static struct rt6_info *addrconf_get_prefix_route(const 
struct in6_addr *pfx,
continue;
if ((rt-rt6i_flags  flags) != flags)
continue;
-   if ((noflags != 0)  ((rt-rt6i_flags  flags) != 0))
+   if ((rt-rt6i_flags  noflags) != 0)
continue;
dst_hold(rt-dst);
break;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 47/81] macvlan: fix macvlan_get_size()

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Eric Dumazet eduma...@google.com

commit 01fe944f1024bd4e5c327ddbe8d657656b66af2f upstream.

commit df8ef8f3aaa (macvlan: add FDB bridge ops and macvlan flags)
forgot to update macvlan_get_size() after the addition of
IFLA_MACVLAN_FLAGS

Signed-off-by: Eric Dumazet eduma...@google.com
Cc: John Fastabend john.r.fastab...@intel.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/macvlan.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 66a9bfe..62ce7b8 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -822,7 +822,10 @@ static int macvlan_changelink(struct net_device *dev,
 
 static size_t macvlan_get_size(const struct net_device *dev)
 {
-   return nla_total_size(4);
+   return (0
+   + nla_total_size(4) /* IFLA_MACVLAN_MODE */
+   + nla_total_size(2) /* IFLA_MACVLAN_FLAGS */
+   );
 }
 
 static int macvlan_fill_info(struct sk_buff *skb,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 48/81] net: calxedaxgmac: throw away overrun frames

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Rob Herring rob.herr...@calxeda.com

commit d6fb3be544b46a7611a3373fcaa62b5b0be01888 upstream.

The xgmac driver assumes 1 frame per descriptor. If a frame larger than
the descriptor's buffer size is received, the frame will spill over into
the next descriptor. So check for received frames that span more than one
descriptor and discard them. This prevents a crash if we receive erroneous
large packets.

Signed-off-by: Rob Herring rob.herr...@calxeda.com
Cc: net...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/ethernet/calxeda/xgmac.c |4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/calxeda/xgmac.c 
b/drivers/net/ethernet/calxeda/xgmac.c
index 8b0a0e4..8a3cd87 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -546,6 +546,10 @@ static int desc_get_rx_status(struct xgmac_priv *priv, 
struct xgmac_dma_desc *p)
return -1;
}
 
+   /* All frames should fit into a single buffer */
+   if (!(status  RXDESC_FIRST_SEG) || !(status  RXDESC_LAST_SEG))
+   return -1;
+
/* Check if packet has checksum already */
if ((status  RXDESC_FRAME_TYPE)  (status  RXDESC_EXT_STATUS) 
!(ext_status  RXDESC_IP_PAYLOAD_MASK))
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 51/81] isdn/gigaset: fix zero size border case in debug dump

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Tilman Schmidt til...@imap.cc

commit d721a1752ba544df8d7d36959038b26bc92bdf80 upstream.

If subtracting 12 from l leaves zero we'd do a zero size allocation,
leading to an oops later when we try to set the NUL terminator.

Reported-by: Dan Carpenter dan.carpen...@oracle.com
Signed-off-by: Tilman Schmidt til...@imap.cc
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/isdn/gigaset/capi.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
index 27e4a3e..f45b5b0 100644
--- a/drivers/isdn/gigaset/capi.c
+++ b/drivers/isdn/gigaset/capi.c
@@ -248,6 +248,8 @@ static inline void dump_rawmsg(enum debuglevel level, const 
char *tag,
CAPIMSG_APPID(data), CAPIMSG_MSGID(data), l,
CAPIMSG_CONTROL(data));
l -= 12;
+   if (l = 0)
+   return;
dbgline = kmalloc(3 * l, GFP_ATOMIC);
if (!dbgline)
return;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 54/81] net: loopback: fix a dst refcounting issue

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Eric Dumazet eduma...@google.com

commit 794ed393b707f01858f5ebe2ae5eabaf89d00022 upstream.

Ben Greear reported crashes in ip_rcv_finish() on a stress
test involving many macvlans.

We tracked the bug to a dst use after free. ip_rcv_finish()
was calling dst-input() and got garbage for dst-input value.

It appears the bug is in loopback driver, lacking
a skb_dst_force() before calling netif_rx().

As a result, a non refcounted dst, normally protected by a
RCU read_lock section, was escaping this section and could
be freed before the packet being processed.

  [813a3c4d] loopback_xmit+0x64/0x83
  [81477364] dev_hard_start_xmit+0x26c/0x35e
  [8147771a] dev_queue_xmit+0x2c4/0x37c
  [81477456] ? dev_hard_start_xmit+0x35e/0x35e
  [8148cfa6] ? eth_header+0x28/0xb6
  [81480f09] neigh_resolve_output+0x176/0x1a7
  [814ad835] ip_finish_output2+0x297/0x30d
  [814ad6d5] ? ip_finish_output2+0x137/0x30d
  [814ad90e] ip_finish_output+0x63/0x68
  [814ae412] ip_output+0x61/0x67
  [814ab904] dst_output+0x17/0x1b
  [814adb6d] ip_local_out+0x1e/0x23
  [814ae1c4] ip_queue_xmit+0x315/0x353
  [814adeaf] ? ip_send_unicast_reply+0x2cc/0x2cc
  [814c018f] tcp_transmit_skb+0x7ca/0x80b
  [814c3571] tcp_connect+0x53c/0x587
  [810c2f0c] ? getnstimeofday+0x44/0x7d
  [810c2f56] ? ktime_get_real+0x11/0x3e
  [814c6f9b] tcp_v4_connect+0x3c2/0x431
  [814d6913] __inet_stream_connect+0x84/0x287
  [814d6b38] ? inet_stream_connect+0x22/0x49
  [8108d695] ? _local_bh_enable_ip+0x84/0x9f
  [8108d6c8] ? local_bh_enable+0xd/0x11
  [8146763c] ? lock_sock_nested+0x6e/0x79
  [814d6b38] ? inet_stream_connect+0x22/0x49
  [814d6b49] inet_stream_connect+0x33/0x49
  [814632c6] sys_connect+0x75/0x98

This bug was introduced in linux-2.6.35, in commit
7fee226ad2397b (net: add a noref bit on skb dst)

skb_dst_force() is enforced in dev_queue_xmit() for devices having a
qdisc.

Reported-by: Ben Greear gree...@candelatech.com
Signed-off-by: Eric Dumazet eduma...@google.com
Tested-by: Ben Greear gree...@candelatech.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/loopback.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 32eb94e..a3d4707 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -77,6 +77,11 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb,
 
skb_orphan(skb);
 
+   /* Before queueing this packet to netif_rx(),
+* make sure dst is refcounted.
+*/
+   skb_dst_force(skb);
+
skb-protocol = eth_type_trans(skb, dev);
 
/* it's OK to use per_cpu_ptr() because BHs are off */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 56/81] ipv6: do not create neighbor entries for local delivery

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Marcelo Ricardo Leitner mleit...@redhat.com

commit bd30e947207e2ea0ff2c08f5b4a03025ddce48d3 upstream.

They will be created at output, if ever needed. This avoids creating
empty neighbor entries when TPROXYing/Forwarding packets for addresses
that are not even directly reachable.

Note that IPv4 already handles it this way. No neighbor entries are
created for local input.

Tested by myself and customer.

Signed-off-by: Jiri Pirko j...@resnulli.us
Signed-off-by: Marcelo Ricardo Leitner mleit...@redhat.com
Signed-off-by: David S. Miller da...@davemloft.net
[ herton: adjust if condition, add additional RTF_LOCAL flag for the
  check ]
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 net/ipv6/route.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index fd44184..08c149c 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -846,7 +846,8 @@ restart:
dst_hold(rt-dst);
read_unlock_bh(table-tb6_lock);
 
-   if (!dst_get_neighbour_noref_raw(rt-dst)  !(rt-rt6i_flags  
RTF_NONEXTHOP))
+   if (!dst_get_neighbour_noref_raw(rt-dst) 
+   !(rt-rt6i_flags  (RTF_NONEXTHOP | RTF_LOCAL)))
nrt = rt6_alloc_cow(rt, fl6-daddr, fl6-saddr);
else if (!(rt-dst.flags  DST_HOST))
nrt = rt6_alloc_clone(rt, fl6-daddr);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 53/81] r8169: remove the obsolete and incorrect AMD workaround

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: =?UTF-8?q?Timo=20Ter=C3=A4s?= timo.te...@iki.fi

commit 5d0feaff230c0abfe4a112e6f09f096ed99e0b2d upstream.

This was introduced in commit 6dccd16 r8169: merge with version
6.001.00 of Realtek's r8169 driver. I did not find the version
6.001.00 online, but in 6.002.00 or any later r8169 from Realtek
this hunk is no longer present.

Also commit 05af214 r8169: fix Ethernet Hangup for RTL8110SC
rev d claims to have fixed this issue otherwise.

The magic compare mask of 0xfffe000 is dubious as it masks
parts of the Reserved part, and parts of the VLAN tag. But this
does not make much sense as the VLAN tag parts are perfectly
valid there. In matter of fact this seems to be triggered with
any VLAN tagged packet as RxVlanTag bit is matched. I would
suspect 0xfffe was intended to test reserved part only.

Finally, this hunk is evil as it can cause more packets to be
handled than what was NAPI quota causing net/core/dev.c:
net_rx_action(): WARN_ON_ONCE(work  weight) to trigger, and
mess up the NAPI state causing device to hang.

As result, any system using VLANs and having high receive
traffic (so that NAPI poll budget limits rtl_rx) would result
in device hang.

Signed-off-by: Timo Teräs timo.te...@iki.fi
Acked-by: Francois Romieu rom...@fr.zoreil.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/ethernet/realtek/r8169.c |7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c 
b/drivers/net/ethernet/realtek/r8169.c
index 0e09bb8..67f73ae 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -5812,13 +5812,6 @@ process_pkt:
tp-rx_stats.bytes += pkt_size;
u64_stats_update_end(tp-rx_stats.syncp);
}
-
-   /* Work around for AMD plateform. */
-   if ((desc-opts2  cpu_to_le32(0xfffe000)) 
-   (tp-mac_version == RTL_GIGA_MAC_VER_05)) {
-   desc-opts2 = 0;
-   cur_rx++;
-   }
}
 
count = cur_rx - tp-cur_rx;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 50/81] net/mlx4_core: Set number of msix vectors under SRIOV mode to firmware defaults

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Or Gerlitz ogerl...@mellanox.com

commit ca4c7b35f75492de7fbf5ee95be07481c348caee upstream.

The lines

if (mlx4_is_mfunc(dev)) {
nreq = 2;
} else {

which hard code the number of requested msi-x vectors under multi-function
mode to two can be removed completely, since the firmware sets num_eqs and
reserved_eqs appropriately Thus, the code line:

nreq = min_t(int, dev-caps.num_eqs - dev-caps.reserved_eqs, nreq);

is by itself sufficient and correct for all cases. Currently, for mfunc
mode num_eqs = 32 and reserved_eqs = 28, hence four vectors will be enabled.

This triples (one vector is used for the async events and commands EQ) the
horse power provided for processing of incoming packets on netdev RSS scheme,
IO initiators/targets commands processing flows, etc.

Reviewed-by: Jack Morgenstein ja...@dev.mellanox.co.il
Signed-off-by: Amir Vadai am...@mellanox.com
Signed-off-by: Or Gerlitz ogerl...@mellanox.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/ethernet/mellanox/mlx4/main.c |   11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c 
b/drivers/net/ethernet/mellanox/mlx4/main.c
index a0313de..c749b82 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -1545,15 +1545,8 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
int i;
 
if (msi_x) {
-   /* In multifunction mode each function gets 2 msi-X vectors
-* one for data path completions anf the other for asynch events
-* or command completions */
-   if (mlx4_is_mfunc(dev)) {
-   nreq = 2;
-   } else {
-   nreq = min_t(int, dev-caps.num_eqs -
-dev-caps.reserved_eqs, nreq);
-   }
+   nreq = min_t(int, dev-caps.num_eqs - dev-caps.reserved_eqs,
+nreq);
 
entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL);
if (!entries)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 45/81] MAINTAINERS: Stephen Hemminger email change

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Stephen Hemminger stephen.hemmin...@vyatta.com

commit adbbf69d1a54abf424e91875746a610dcc80017d upstream.

I changed my email because the vyatta.com mail server is now
redirected to brocade.com; and the Brocade mail system
is not friendly to Linux desktop users.

Signed-off-by: Stephen Hemminger step...@networkplumber.org
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 MAINTAINERS |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 0d67d1b..5927882 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2663,7 +2663,7 @@ S:Maintained
 F: drivers/net/ethernet/i825xx/eexpress.*
 
 ETHERNET BRIDGE
-M: Stephen Hemminger shemmin...@vyatta.com
+M: Stephen Hemminger step...@networkplumber.org
 L: bri...@lists.linux-foundation.org
 L: net...@vger.kernel.org
 W: http://www.linuxfoundation.org/en/Net:Bridge
@@ -4385,7 +4385,7 @@ S:Maintained
 
 MARVELL GIGABIT ETHERNET DRIVERS (skge/sky2)
 M: Mirko Lindner mlind...@marvell.com
-M: Stephen Hemminger shemmin...@vyatta.com
+M: Stephen Hemminger step...@networkplumber.org
 L: net...@vger.kernel.org
 S: Maintained
 F: drivers/net/ethernet/marvell/sk*
@@ -4630,7 +4630,7 @@ S:Supported
 F: drivers/infiniband/hw/nes/
 
 NETEM NETWORK EMULATOR
-M: Stephen Hemminger shemmin...@vyatta.com
+M: Stephen Hemminger step...@networkplumber.org
 L: ne...@lists.linux-foundation.org
 S: Maintained
 F: net/sched/sch_netem.c
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 41/81] kernel/resource.c: fix stack overflow in __reserve_region_with_split()

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: T Makphaibulchoke t...@hp.com

commit 4965f5667f36a95b41cda6638875bc992bd7d18b upstream.

Using a recursive call add a non-conflicting region in
__reserve_region_with_split() could result in a stack overflow in the case
that the recursive calls are too deep.  Convert the recursive calls to an
iterative loop to avoid the problem.

Tested on a machine containing 135 regions.  The kernel no longer panicked
with stack overflow.

Also tested with code arbitrarily adding regions with no conflict,
embedding two consecutive conflicts and embedding two non-consecutive
conflicts.

Signed-off-by: T Makphaibulchoke t...@hp.com
Reviewed-by: Ram Pai linux...@us.ibm.com
Cc: Paul Gortmaker paul.gortma...@gmail.com
Cc: Wei Yang weiy...@linux.vnet.ibm.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
Cc: Jiri Slaby jsl...@suse.cz
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 kernel/resource.c |   50 ++
 1 file changed, 38 insertions(+), 12 deletions(-)

diff --git a/kernel/resource.c b/kernel/resource.c
index e1d2b8e..7de982e 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -758,6 +758,7 @@ static void __init __reserve_region_with_split(struct 
resource *root,
struct resource *parent = root;
struct resource *conflict;
struct resource *res = kzalloc(sizeof(*res), GFP_ATOMIC);
+   struct resource *next_res = NULL;
 
if (!res)
return;
@@ -767,21 +768,46 @@ static void __init __reserve_region_with_split(struct 
resource *root,
res-end = end;
res-flags = IORESOURCE_BUSY;
 
-   conflict = __request_resource(parent, res);
-   if (!conflict)
-   return;
+   while (1) {
 
-   /* failed, split and try again */
-   kfree(res);
+   conflict = __request_resource(parent, res);
+   if (!conflict) {
+   if (!next_res)
+   break;
+   res = next_res;
+   next_res = NULL;
+   continue;
+   }
 
-   /* conflict covered whole area */
-   if (conflict-start = start  conflict-end = end)
-   return;
+   /* conflict covered whole area */
+   if (conflict-start = res-start 
+   conflict-end = res-end) {
+   kfree(res);
+   WARN_ON(next_res);
+   break;
+   }
+
+   /* failed, split and try again */
+   if (conflict-start  res-start) {
+   end = res-end;
+   res-end = conflict-start - 1;
+   if (conflict-end  end) {
+   next_res = kzalloc(sizeof(*next_res),
+   GFP_ATOMIC);
+   if (!next_res) {
+   kfree(res);
+   break;
+   }
+   next_res-name = name;
+   next_res-start = conflict-end + 1;
+   next_res-end = end;
+   next_res-flags = IORESOURCE_BUSY;
+   }
+   } else {
+   res-start = conflict-end + 1;
+   }
+   }
 
-   if (conflict-start  start)
-   __reserve_region_with_split(root, start, conflict-start-1, 
name);
-   if (conflict-end  end)
-   __reserve_region_with_split(root, conflict-end+1, end, name);
 }
 
 void __init reserve_region_with_split(struct resource *root,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 40/81] HID: usbhid: quirk for Formosa IR receiver

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Nicholas Santos nicholas.san...@gmail.com

commit 320cde19a4e8f122b19d2df7a5c00636e11ca3fb upstream.

Patch to add the Formosa Industrial Computing, Inc. Infrared Receiver
[IR605A/Q] to hid-ids.h and hid-quirks.c.  This IR receiver causes about a 10
second timeout when the usbhid driver attempts to initialze the device.  Adding
this device to the quirks list with HID_QUIRK_NO_INIT_REPORTS removes the
delay.

Signed-off-by: Nicholas Santos nicholas.san...@gmail.com
[jkos...@suse.cz: fix ordering]
Signed-off-by: Jiri Kosina jkos...@suse.cz
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/hid/hid-ids.h   |3 +++
 drivers/hid/usbhid/hid-quirks.c |1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 5ddfcc7..dc48cd1 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -296,6 +296,9 @@
 #define USB_VENDOR_ID_EZKEY0x0518
 #define USB_DEVICE_ID_BTC_8193 0x0002
 
+#define USB_VENDOR_ID_FORMOSA  0x147a
+#define USB_DEVICE_ID_FORMOSA_IR_RECEIVER  0xe03e
+
 #define USB_VENDOR_ID_FREESCALE0x15A2
 #define USB_DEVICE_ID_FREESCALE_MX28   0x004F
 
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 8865fa3..1a4bc41 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -70,6 +70,7 @@ static const struct hid_blacklist {
{ USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
+   { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, 
HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, 
HID_QUIRK_NOGET },
{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN, 
HID_QUIRK_NO_INIT_REPORTS },
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 34/81] rtlwifi: Fix scheduling while atomic bug

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Larry Finger larry.fin...@lwfinger.net

commit a5ffbe0a1993a27072742ef7db6cf9839956fce9 upstream.

Kernel commits 41affd5 and 6539306 changed the locking in rtl_lps_leave()
from a spinlock to a mutex by doing the calls indirectly from a work queue
to reduce the time that interrupts were disabled. This change was fine for
most systems; however a scheduling while atomic bug was reported in
https://bugzilla.redhat.com/show_bug.cgi?id=903881. The backtrace indicates
that routine rtl_is_special(), which calls rtl_lps_leave() in three places
was entered in atomic context. These direct calls are replaced by putting a
request on the appropriate work queue.

Signed-off-by: Larry Finger larry.fin...@lwfinger.net
Reported-and-tested-by: Nathaniel Doherty ntdohe...@gmail.com
Cc: Nathaniel Doherty ntdohe...@gmail.com
Cc: Stanislaw Gruszka sgrus...@redhat.com
Signed-off-by: John W. Linville linvi...@tuxdriver.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/net/wireless/rtlwifi/base.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/base.c 
b/drivers/net/wireless/rtlwifi/base.c
index f4c852c..4110a6d 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -980,7 +980,8 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct 
sk_buff *skb, u8 is_tx)
 is_tx ? Tx : Rx);
 
if (is_tx) {
-   rtl_lps_leave(hw);
+   schedule_work(rtlpriv-
+ works.lps_leave_work);
ppsc-last_delaylps_stamp_jiffies =
jiffies;
}
@@ -990,7 +991,7 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct 
sk_buff *skb, u8 is_tx)
}
} else if (ETH_P_ARP == ether_type) {
if (is_tx) {
-   rtl_lps_leave(hw);
+   schedule_work(rtlpriv-works.lps_leave_work);
ppsc-last_delaylps_stamp_jiffies = jiffies;
}
 
@@ -1000,7 +1001,7 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct 
sk_buff *skb, u8 is_tx)
 802.1X %s EAPOL pkt!!\n, is_tx ? Tx : Rx);
 
if (is_tx) {
-   rtl_lps_leave(hw);
+   schedule_work(rtlpriv-works.lps_leave_work);
ppsc-last_delaylps_stamp_jiffies = jiffies;
}
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 38/81] drivers/rtc/rtc-pl031.c: fix the missing operation on enable

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Haojian Zhuang haojian.zhu...@linaro.org

commit e7e034e18a0ab6bafb2425c3242cac311164f4d6 upstream.

The RTC control register should be enabled in the process of
initializing.

Without this patch, I failed to enable RTC in Hisilicon Hi3620 SoC.  The
register mapping section in RTC is always read as zero.  So I doubt that
ST guys may already enable this register in bootloader.  So they won't
meet this issue.

Signed-off-by: Haojian Zhuang haojian.zhu...@linaro.org
Cc: Srinidhi Kasagar srinidhi.kasa...@stericsson.com
Cc: Linus Walleij linus.wall...@linaro.org
Cc: Alessandro Zummo a.zu...@towertech.it
Signed-off-by: Andrew Morton a...@linux-foundation.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 drivers/rtc/rtc-pl031.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index cc05339..c42054b 100644
--- a/drivers/rtc/rtc-pl031.c
+++ b/drivers/rtc/rtc-pl031.c
@@ -44,6 +44,7 @@
 #define RTC_YMR0x34/* Year match register */
 #define RTC_YLR0x38/* Year data load register */
 
+#define RTC_CR_EN  (1  0)/* counter enable bit */
 #define RTC_CR_CWEN(1  26)   /* Clockwatch enable bit */
 
 #define RTC_TCR_EN (1  1) /* Periodic timer enable bit */
@@ -304,7 +305,7 @@ static int pl031_probe(struct amba_device *adev, const 
struct amba_id *id)
int ret;
struct pl031_local *ldata;
struct rtc_class_ops *ops = id-data;
-   unsigned long time;
+   unsigned long time, data;
 
ret = amba_request_regions(adev, NULL);
if (ret)
@@ -331,10 +332,11 @@ static int pl031_probe(struct amba_device *adev, const 
struct amba_id *id)
dev_dbg(adev-dev, designer ID = 0x%02x\n, ldata-hw_designer);
dev_dbg(adev-dev, revision = 0x%01x\n, ldata-hw_revision);
 
+   data = readl(ldata-base + RTC_CR);
/* Enable the clockwatch on ST Variants */
if (ldata-hw_designer == AMBA_VENDOR_ST)
-   writel(readl(ldata-base + RTC_CR) | RTC_CR_CWEN,
-  ldata-base + RTC_CR);
+   data |= RTC_CR_CWEN;
+   writel(data | RTC_CR_EN, ldata-base + RTC_CR);
 
/*
 * On ST PL031 variants, the RTC reset value does not provide correct
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 36/81] mm/hugetlb: set PTE as huge in hugetlb_change_protection and remove_migration_pte

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Tony Lu z...@tilera.com

commit be7517d6ab9722f0abad6ba5ffd39cfced95549c upstream.

When setting a huge PTE, besides calling pte_mkhuge(), we also need to
call arch_make_huge_pte(), which we indeed do in make_huge_pte(), but we
forget to do in hugetlb_change_protection() and remove_migration_pte().

Signed-off-by: Zhigang Lu z...@tilera.com
Signed-off-by: Chris Metcalf cmetc...@tilera.com
Reviewed-by: Michal Hocko mho...@suse.cz
Acked-by: Hillf Danton dhi...@gmail.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
Signed-off-by: Linus Torvalds torva...@linux-foundation.org
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 mm/hugetlb.c |1 +
 mm/migrate.c |4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 9c34eb5..33d8b38 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2972,6 +2972,7 @@ void hugetlb_change_protection(struct vm_area_struct *vma,
if (!huge_pte_none(huge_ptep_get(ptep))) {
pte = huge_ptep_get_and_clear(mm, address, ptep);
pte = pte_mkhuge(pte_modify(pte, newprot));
+   pte = arch_make_huge_pte(pte, vma, NULL, 0);
set_huge_pte_at(mm, address, ptep, pte);
}
}
diff --git a/mm/migrate.c b/mm/migrate.c
index be26d5c..2e03986 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -142,8 +142,10 @@ static int remove_migration_pte(struct page *new, struct 
vm_area_struct *vma,
if (is_write_migration_entry(entry))
pte = pte_mkwrite(pte);
 #ifdef CONFIG_HUGETLB_PAGE
-   if (PageHuge(new))
+   if (PageHuge(new)) {
pte = pte_mkhuge(pte);
+   pte = arch_make_huge_pte(pte, vma, new, 0);
+   }
 #endif
flush_cache_page(vma, addr, pte_pfn(pte));
set_pte_at(mm, addr, ptep, pte);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 21/81] x86-64: Replace left over sti/cli in ia32 audit exit code

2013-02-19 Thread Herton Ronaldo Krzesinski
3.5.7.6 -stable review patch.  If anyone has any objections, please let me know.

--

From: Jan Beulich jbeul...@suse.com

commit 40a1ef95da85843696fc3ebe5fce39b0db32669f upstream.

For some reason they didn't get replaced so far by their
paravirt equivalents, resulting in code to be run with
interrupts disabled that doesn't expect so (causing, in the
observed case, a BUG_ON() to trigger) when syscall auditing is
enabled.

David (Cc-ed) came up with an identical fix, so likely this can
be taken to count as an ack from him.

Reported-by: Peter Moody pmo...@google.com
Signed-off-by: Jan Beulich jbeul...@suse.com
Cc: David Vrabel david.vra...@citrix.com
Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com
Link: http://lkml.kernel.org/r/5108e0190278000ba...@nat28.tlf.novell.com
Signed-off-by: Ingo Molnar mi...@kernel.org
Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com
Cc: David Vrabel david.vra...@citrix.com
Tested-by: Peter Moody pmo...@google.com
Signed-off-by: Herton Ronaldo Krzesinski herton.krzesin...@canonical.com
---
 arch/x86/ia32/ia32entry.S |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 20e5f7b..f6d477a 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -204,7 +204,7 @@ sysexit_from_sys_call:
testl $(_TIF_ALLWORK_MASK  
~_TIF_SYSCALL_AUDIT),TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
jnz ia32_ret_from_sys_call
TRACE_IRQS_ON
-   sti
+   ENABLE_INTERRUPTS(CLBR_NONE)
movl %eax,%esi  /* second arg, syscall return value */
cmpl $-MAX_ERRNO,%eax   /* is it an error ? */
jbe 1f
@@ -214,7 +214,7 @@ sysexit_from_sys_call:
call __audit_syscall_exit
movq RAX-ARGOFFSET(%rsp),%rax   /* reload syscall return value */
movl $(_TIF_ALLWORK_MASK  ~_TIF_SYSCALL_AUDIT),%edi
-   cli
+   DISABLE_INTERRUPTS(CLBR_NONE)
TRACE_IRQS_OFF
testl %edi,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
jz \exit
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


<    1   2   3   4   5   6   7   8   9   10   >