]> git.baikalelectronics.ru Git - kernel.git/commit
IB/core: Fix possible crash to access NULL netdev
authorParav Pandit <parav@mellanox.com>
Wed, 7 Mar 2018 06:07:41 +0000 (08:07 +0200)
committerDoug Ledford <dledford@redhat.com>
Wed, 7 Mar 2018 20:15:40 +0000 (15:15 -0500)
commit19888a5a744ba3aa774aaad4ef7db0bbf7ddf8f1
treee422de5ac9356ee58a3a097c8645569c1e33c98a
parentf174244a101973ece23a8bf7e6ec9714a5dd1a7b
IB/core: Fix possible crash to access NULL netdev

resolved_dev returned might be NULL as ifindex is transient number.
Ignoring NULL check of resolved_dev might crash the kernel.
Therefore perform NULL check before accessing resolved_dev.

Additionally rdma_resolve_ip_route() invokes addr_resolve() which
performs check and address translation for loopback ifindex.
Therefore, checking it again in rdma_resolve_ip_route() is not helpful.
Therefore, the code is simplified to avoid IFF_LOOPBACK check.

Fixes: 1fa0844b8fa3 ("IB/core: Validate route when we init ah")
Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/sa_query.c