• Jack Morgenstein's avatar
    IB/mlx4: Fix out-of-range array index in destroy qp flow · c482af64
    Jack Morgenstein authored
    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: 9433c188 ("IB/mlx4: Invoke UPDATE_QP for proxy QP1 on MAC changes")
    Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
    Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
    Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
    c482af64
qp.c 100 KB