]> git.baikalelectronics.ru Git - kernel.git/commit
IB/cm: Fix memory corruption in handling CM request
authorParav Pandit <parav@mellanox.com>
Thu, 19 Oct 2017 05:40:30 +0000 (08:40 +0300)
committerDoug Ledford <dledford@redhat.com>
Wed, 25 Oct 2017 18:37:03 +0000 (14:37 -0400)
commite5e141f3ef63d836f881b6ed4a97f305c2a91fa7
tree2f97ccd988803063be0045490f7e37c04fb158f8
parent06cb8e35c84f188373f12d871feda5d645012713
IB/cm: Fix memory corruption in handling CM request

In recent code, two path record entries are alwasy cleared while
allocated could be either one or two path record entries.
This leads to zero out of unallocated memory.

This fix initializes alternative path record only when alternative path
is set.

While we are at it, path record allocation doesn't check for OPA
alternative path, but rest of the code checks for OPA alternative path.
Path record allocation code doesn't check for OPA alternative LID.
This can further lead to memory corruption when only one path record is
allocated, but there is actually alternative OPA path record present in CM
request.

Cc: <stable@vger.kernel.org> # v4.12+
Fixes: cfe6481d5f7a ("IB/SA: Split struct sa_path_rec based on IB and ROCE specific fields")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Moni Shoua <monis@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/cm.c