]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/core: Fix unsafe linked list traversal after failing to allocate CQ
authorXi Wang <wangxi11@huawei.com>
Tue, 1 Sep 2020 12:38:55 +0000 (20:38 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Wed, 2 Sep 2020 18:56:40 +0000 (15:56 -0300)
commit6cf907fca0c9520979b6fbe2fcefe728abc20b39
treeb7ba451adcccf7febccdc91709063f0f2c11132f
parenta6c4f3ed029e42caf2dc08fad944a48e99ca6b28
RDMA/core: Fix unsafe linked list traversal after failing to allocate CQ

It's not safe to access the next CQ in list_for_each_entry() after
invoking ib_free_cq(), because the CQ has already been freed in current
iteration.  It should be replaced by list_for_each_entry_safe().

Fixes: 4a6bd44cb4e1 ("RDMA/core: Introduce shared CQ pool API")
Link: https://lore.kernel.org/r/1598963935-32335-1-git-send-email-liweihang@huawei.com
Signed-off-by: Xi Wang <wangxi11@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/core/cq.c