Commit ea5ef136 authored by Yuan Can's avatar Yuan Can Committed by Leon Romanovsky

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: c4ffee7c ("RDMA/netlink: Implement counter dumpit calback")
Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
Link: https://lore.kernel.org/r/20221126043410.85632-1-yuancan@huawei.comSigned-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent 09f530f0
...@@ -894,6 +894,8 @@ static int fill_stat_counter_qps(struct sk_buff *msg, ...@@ -894,6 +894,8 @@ static int fill_stat_counter_qps(struct sk_buff *msg,
int ret = 0; int ret = 0;
table_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_RES_QP); table_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_RES_QP);
if (!table_attr)
return -EMSGSIZE;
rt = &counter->device->res[RDMA_RESTRACK_QP]; rt = &counter->device->res[RDMA_RESTRACK_QP];
xa_lock(&rt->xa); xa_lock(&rt->xa);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment