RDMA/core: Trigger a WARN_ON if the driver causes uobjects to become leaked

Drivers that fail destroy can cause uverbs to leak uobjects. Drivers are
required to always eventually destroy their ubojects, so trigger a WARN_ON
to detect this driver bug.

Link: https://lore.kernel.org/r/0-v1-b1e0ed400ba9+f7-warn_destroy_ufile_hw_jgg@nvidia.comReviewed-by: NLeon Romanovsky <leonro@nvidia.com>
Reviewed-by: NGal Pressman <galpress@amazon.com>
Signed-off-by: NJason Gunthorpe <jgg@nvidia.com>
上级 074bf2c2
...@@ -895,8 +895,9 @@ void uverbs_destroy_ufile_hw(struct ib_uverbs_file *ufile, ...@@ -895,8 +895,9 @@ void uverbs_destroy_ufile_hw(struct ib_uverbs_file *ufile,
if (__uverbs_cleanup_ufile(ufile, reason)) { if (__uverbs_cleanup_ufile(ufile, reason)) {
/* /*
* No entry was cleaned-up successfully during this * No entry was cleaned-up successfully during this
* iteration * iteration. It is a driver bug to fail destruction.
*/ */
WARN_ON(!list_empty(&ufile->uobjects));
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部