]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
RDMA/uverbs: Expand primary and alt AV port checks
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Wed, 11 Jul 2018 08:23:52 +0000 (11:23 +0300)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:41:47 +0000 (19:41 -0600)
commitdd7a6e6bfec9733874046354249ceb48b458af12
treecea2fc5955d281a53313d2c2dfee7aa6998755b8
parent8b8be3e5ac9a7e851c9a370d77317f4c3181a6fd
RDMA/uverbs: Expand primary and alt AV port checks

BugLink: https://bugs.launchpad.net/bugs/1835845
commit addb8a6559f0f8b5a37582b7ca698358445a55bf upstream.

The commit cited below checked that the port numbers provided in the
primary and alt AVs are legal.

That is sufficient to prevent a kernel panic. However, it is not
sufficient for correct operation.

In Linux, AVs (both primary and alt) must be completely self-described.
We do not accept an AV from userspace without an embedded port number.
(This has been the case since kernel 3.14 commit dbf727de7440
("IB/core: Use GID table in AH creation and dmac resolution")).

For the primary AV, this embedded port number must match the port number
specified with IB_QP_PORT.

We also expect the port number embedded in the alt AV to match the
alt_port_num value passed by the userspace driver in the modify_qp command
base structure.

Add these checks to modify_qp.

Cc: <stable@vger.kernel.org> # 4.16
Fixes: 5d4c05c3ee36 ("RDMA/uverbs: Sanitize user entered port numbers prior to access it")
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/infiniband/core/uverbs_cmd.c