]> git.baikalelectronics.ru Git - kernel.git/commit
net/mlx4: Copy/set only sizeof struct mlx4_eqe bytes
authorCarol L Soto <clsoto@linux.vnet.ibm.com>
Tue, 27 Oct 2015 15:36:20 +0000 (17:36 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Oct 2015 03:27:11 +0000 (20:27 -0700)
commit255835fa4d0e7df8c28e43f3719d95e17ea3f9ef
tree92970763d841b4822050c38922a1bdb43369d289
parente755df9952eeadd0e8d81e0b64c0ca77cdef6112
net/mlx4: Copy/set only sizeof struct mlx4_eqe bytes

When doing memcpy/memset of EQEs, we should use sizeof struct
mlx4_eqe as the base size and not caps.eqe_size which could be bigger.

If caps.eqe_size is bigger than the struct mlx4_eqe then we corrupt
data in the master context.

When using a 64 byte stride, the memcpy copied over 63 bytes to the
slave_eq structure.  This resulted in copying over the entire eqe of
interest, including its ownership bit -- and also 31 bytes of garbage
into the next WQE in the slave EQ -- which did NOT include the ownership
bit (and therefore had no impact).

However, once the stride is increased to 128, we are overwriting the
ownership bits of *three* eqes in the slave_eq struct.  This results
in an incorrect ownership bit for those eqes, which causes the eq to
seem to be full. The issue therefore surfaced only once 128-byte EQEs
started being used in SRIOV and (overarchitectures that have 128/256
byte cache-lines such as PPC) - e.g after commit 6cbe45eec065
"net/mlx4_core: Enable CQE/EQE stride support".

Fixes: 931c01c048e4 ('mlx4: 64-byte CQE/EQE support')
Signed-off-by: Carol L Soto <clsoto@linux.vnet.ibm.com>
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/cmd.c
drivers/net/ethernet/mellanox/mlx4/eq.c