[lvc-project] [PATCH] RDMA/core: Add error handling in rdma_user_mmap_disassociate.
Fedor Pchelkin
pchelkin at ispras.ru
Thu Jan 15 12:11:30 MSK 2026
On Wed, 14. Jan 20:53, Danila Chernetsov wrote:
> rdma_user_mmap_disassociate can be called before
> ib_set_client_data(device, &uverbs_client, uverbs_dev); and cause an error
> when calling ib_get_client_data.
> Also, consider checking the result of ib_get_client_data to handle errors
> in other functions.
Длины строк текста выше не выдержаны и составлены как-то вразнобой.
В чём заключается решаемая патчем проблема и при каких предполагаемых
условиях она может возникнуть? Это непонятно, учитывая вдобавок что
возвращаемое значение самой функции rdma_user_mmap_disassociate() патч не
предлагает обрабатывать.
>
> Fixes: 51976c6cd786 ("RDMA/core: Provide rdma_user_mmap_disassociate() to disassociate mmap pages")
> Signed-off-by: Danila Chernetsov <listdansp at mail.ru>
> ---
> drivers/infiniband/core/uverbs_main.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
> index 973fe2c7ef53..a8a2d87f4d3e 100644
> --- a/drivers/infiniband/core/uverbs_main.c
> +++ b/drivers/infiniband/core/uverbs_main.c
> @@ -901,10 +901,12 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile)
> * This function should be called by drivers that need to disable mmaps for the
> * device, for instance because it is going to be reset.
> */
> -void rdma_user_mmap_disassociate(struct ib_device *device)
> +int rdma_user_mmap_disassociate(struct ib_device *device)
Функция не статическая => где-то должно быть её объявление, а его патч
по некой причине не затрагивает => ждём сообщение с адреса
"kernel test robot <lkp at intel.com>" об ошибках сборки :(
> {
> struct ib_uverbs_device *uverbs_dev =
> ib_get_client_data(device, &uverbs_client);
> + if (!uverbs_dev)
> + return -ENODEV;
> struct ib_uverbs_file *ufile;
>
declaration-after-statement в коде ядра не приветствуются, раньше на них
даже выдавалось предупреждение при сборке ядра:
commit b5ec6fd286dfa466f64cb0e56ed768092d0342ae
Author: Peter Zijlstra <peterz at infradead.org>
Date: Fri Jun 9 11:28:30 2023 +0200
kbuild: Drop -Wdeclaration-after-statement
With the advent on scope-based resource management it comes really
tedious to abide by the contraints of -Wdeclaration-after-statement.
It will still be recommeneded to place declarations at the start of a
scope where possible, but it will no longer be enforced.
Suggested-by: Linus Torvalds <torvalds at linux-foundation.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz at infradead.org>
Link: https://lkml.kernel.org/r/CAHk-%3Dwi-RyoUhbChiVaJZoZXheAwnJ7OO%3DGxe85BkPAd93TwDA%40mail.gmail.com
> mutex_lock(&uverbs_dev->lists_mutex);
> @@ -913,6 +915,7 @@ void rdma_user_mmap_disassociate(struct ib_device *device)
> uverbs_user_mmap_disassociate(ufile);
> }
> mutex_unlock(&uverbs_dev->lists_mutex);
> + return 0;
Что делает патч, категорически непонятно. Просьба направлять их на
предварительное ревью в lvc-patches at linuxtesting.org.
> }
> EXPORT_SYMBOL(rdma_user_mmap_disassociate);
>
> --
> 2.25.1
More information about the lvc-project
mailing list