]> git.baikalelectronics.ru Git - kernel.git/commit
IB/mlx4: Fix out-of-range array index in destroy qp flow
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Sun, 27 Nov 2016 13:18:19 +0000 (15:18 +0200)
committerDoug Ledford <dledford@redhat.com>
Tue, 13 Dec 2016 18:39:46 +0000 (13:39 -0500)
commit66144180d6bfd0578c010c63f1677563fa0da559
tree66e0776299a50052531a7d99a0a42b8d9f484daf
parent201e69f626f7f0c283a9956f0a6d372577d8cf83
IB/mlx4: Fix out-of-range array index in destroy qp flow

For non-special QPs, the port value becomes non-zero only at the
RESET-to-INIT transition. If the QP has not undergone that transition,
its port number value is still zero.

If such a QP is destroyed before being moved out of the RESET state,
subtracting one from the qp port number results in a negative value.
Using that negative value as an index into the qp1_proxy array
results in an out-of-bounds array reference.

Fix this by testing that the QP type is one that uses qp1_proxy before
using the port number. For special QPs of all types, the port number is
specified at QP creation time.

Fixes: b0b0730e8c29 ("IB/mlx4: Invoke UPDATE_QP for proxy QP1 on MAC changes")
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/mlx4/qp.c