RDMA/nldev: Add checks for nla_nest_start() in fill_stat_counter_qps()

Bugzilla: https://bugzilla.redhat.com/2168936

commit ea5ef136e215fdef35f14010bc51fcd6686e6922
Author: Yuan Can <yuancan@huawei.com>
Date:   Sat Nov 26 04:34:10 2022 +0000

    RDMA/nldev: Add checks for nla_nest_start() in fill_stat_counter_qps()

    As the nla_nest_start() may fail with NULL returned, the return value needs
    to be checked.

    Fixes: c4ffee7c9b ("RDMA/netlink: Implement counter dumpit calback")
    Signed-off-by: Yuan Can <yuancan@huawei.com>
    Link: https://lore.kernel.org/r/20221126043410.85632-1-yuancan@huawei.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>

Signed-off-by: Kamal Heib <kheib@redhat.com>
This commit is contained in:
Kamal Heib 2023-02-28 10:03:38 -05:00
parent 771ab87bb4
commit 5344cfacbd
1 changed files with 2 additions and 0 deletions

View File

@ -894,6 +894,8 @@ static int fill_stat_counter_qps(struct sk_buff *msg,
int ret = 0;
table_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_RES_QP);
if (!table_attr)
return -EMSGSIZE;
rt = &counter->device->res[RDMA_RESTRACK_QP];
xa_lock(&rt->xa);