summaryrefslogtreecommitdiff
path: root/drivers/infiniband/core
diff options
context:
space:
mode:
authorYuan Can <yuancan@huawei.com>2022-11-26 07:34:10 +0300
committerLeon Romanovsky <leon@kernel.org>2022-11-28 14:43:51 +0300
commitea5ef136e215fdef35f14010bc51fcd6686e6922 (patch)
tree32c0e447aef347131a256e9420b6f425ed32c363 /drivers/infiniband/core
parent09f530f0c6d6689eee5e690c6d98f495fcc3a0f9 (diff)
downloadlinux-ea5ef136e215fdef35f14010bc51fcd6686e6922.tar.xz
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: c4ffee7c9bdb ("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>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r--drivers/infiniband/core/nldev.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index 2be76a3fdd87..ca0ed7d14326 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -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);