TencentOS-kernel/drivers/infiniband
Tom Rix 9f6fcbea23 RDMA/ocrdma: Fix use after free in ocrdma_dealloc_ucontext_pd()
commit f2bc3af6353cb2a33dfa9d270d999d839eef54cb upstream.

In ocrdma_dealloc_ucontext_pd() uctx->cntxt_pd is assigned to the variable
pd and then after uctx->cntxt_pd is freed, the variable pd is passed to
function _ocrdma_dealloc_pd() which dereferences pd directly or through
its call to ocrdma_mbx_dealloc_pd().

Reorder the free using the variable pd.

Cc: stable@vger.kernel.org
Fixes: 21a428a019c9 ("RDMA: Handle PD allocations by IB/core")
Link: https://lore.kernel.org/r/20201230024653.1516495-1-trix@redhat.com
Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-12 12:51:22 +08:00
..
core RDMA/cma: Don't overwrite sgid_attr after device is released 2021-03-16 16:43:15 +08:00
hw RDMA/ocrdma: Fix use after free in ocrdma_dealloc_ucontext_pd() 2021-04-12 12:51:22 +08:00
sw RDMA/rxe: Compute PSN windows correctly 2021-03-16 16:42:38 +08:00
ulp RDMA/ipoib: Set rtnl_link_ops for ipoib interfaces 2021-03-16 16:38:56 +08:00
Kconfig RMDA/sw: Don't allow drivers using dma_virt_ops on highmem configs 2021-03-16 16:41:16 +08:00
Makefile Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00