Re: [PATCH 2/2] dma-mapping: benchmark: prevent potential kthread hang

From: Fedor Pchelkin
Date: Fri May 03 2024 - 11:39:47 EST


On Fri, 03. May 13:44, Barry Song wrote:
> On Fri, May 3, 2024 at 4:29 AM Fedor Pchelkin <pchelkin@xxxxxxxxx> wrote:
>

[...]

> do we still need to do copy_to_user(argp, &map->bparam, sizeof(map->bparam)
> after do_map_benchmark(map) fails?
> do we also need the below?
> diff --git a/kernel/dma/map_benchmark.c b/kernel/dma/map_benchmark.c
> index 02205ab53b7e..28ca165cb62c 100644
> --- a/kernel/dma/map_benchmark.c
> +++ b/kernel/dma/map_benchmark.c
> @@ -252,6 +252,9 @@ static long map_benchmark_ioctl(struct file *file,
> unsigned int cmd,
> * dma_mask changed by benchmark
> */
> dma_set_mask(map->dev, old_dma_mask);
> +
> + if (ret)
> + return ret;
> break;
> default:
> return -EINVAL;
>
>

Good point, thank you! If benchmark failed, nothing new to be copied back
to user, indeed.

I'll add this as the third patch of the series and post v2.