From: Yuan Can <yuancan@huawei.com>
To: <jgg@ziepe.ca>, <leon@kernel.org>, <mgurtovoy@nvidia.com>,
<error27@gmail.com>, <chenzhongjin@huawei.com>,
<markz@mellanox.com>, <majd@mellanox.com>,
<linux-rdma@vger.kernel.org>
Cc: <yuancan@huawei.com>
Subject: [PATCH] RDMA/nldev: Add checks for nla_nest_start() in fill_stat_counter_qps()
Date: Sat, 26 Nov 2022 04:34:10 +0000 [thread overview]
Message-ID: <20221126043410.85632-1-yuancan@huawei.com> (raw)
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>
---
drivers/infiniband/core/nldev.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index 12dc97067ed2..f3309f07e466 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);
--
2.17.1
next reply other threads:[~2022-11-26 4:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-26 4:34 Yuan Can [this message]
2022-11-28 11:44 ` [PATCH] RDMA/nldev: Add checks for nla_nest_start() in fill_stat_counter_qps() Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221126043410.85632-1-yuancan@huawei.com \
--to=yuancan@huawei.com \
--cc=chenzhongjin@huawei.com \
--cc=error27@gmail.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=majd@mellanox.com \
--cc=markz@mellanox.com \
--cc=mgurtovoy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox