public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/nldev: Add checks for nla_nest_start() in fill_stat_counter_qps()
@ 2022-11-26  4:34 Yuan Can
  2022-11-28 11:44 ` Leon Romanovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Yuan Can @ 2022-11-26  4:34 UTC (permalink / raw)
  To: jgg, leon, mgurtovoy, error27, chenzhongjin, markz, majd,
	linux-rdma
  Cc: yuancan

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] RDMA/nldev: Add checks for nla_nest_start() in fill_stat_counter_qps()
  2022-11-26  4:34 [PATCH] RDMA/nldev: Add checks for nla_nest_start() in fill_stat_counter_qps() Yuan Can
@ 2022-11-28 11:44 ` Leon Romanovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2022-11-28 11:44 UTC (permalink / raw)
  To: linux-rdma, markz, error27, Yuan Can, majd, jgg, mgurtovoy,
	chenzhongjin

On Sat, 26 Nov 2022 04:34:10 +0000, Yuan Can wrote:
> As the nla_nest_start() may fail with NULL returned, the return value needs
> to be checked.
> 
> 

Applied, thanks!

[1/1] RDMA/nldev: Add checks for nla_nest_start() in fill_stat_counter_qps()
      https://git.kernel.org/rdma/rdma/c/ea5ef136e215fd

Best regards,
-- 
Leon Romanovsky <leon@kernel.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-28 11:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-26  4:34 [PATCH] RDMA/nldev: Add checks for nla_nest_start() in fill_stat_counter_qps() Yuan Can
2022-11-28 11:44 ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox