Re: [PATCH] cxl/hdm: fix a warning in devm_remove_action()
From: Ira Weiny
Date: Mon Mar 09 2026 - 15:36:26 EST
Sungwoo Kim wrote:
> In the following race scenario, devm_remove_action() can be called
> before devm_add_action(), triggering a warning because there is no
> action to remove.
>
> To fix this, extend a critical section to embrace both
> __cxl_dpa_reserve() and devm_add_action().
>
> task 1:
> cxl_dpa_alloc()
> __cxl_dpa_reserve() ...(1)
> devm_add_action() ...(4)
>
> task 2:
> cxl_dpa_free()
> guard()
> if (!cxled->dpa_res) ...(2) pass, due to (1)
> return 0;
> devm_cxl_dpa_release()
> devm_remove_action() ...(3) warning, no action is added yet
>
> Warning log:
>
[snip]
>
> Fixes: cf880423b6a0 ("cxl/hdm: Add support for allocating DPA to an endpoint decoder")
> Fixes: 9c57cde0dcbd ("cxl/hdm: Enumerate allocated DPA")
> Signed-off-by: Sungwoo Kim <iam@xxxxxxxxxxxx>
Reviewed-by: Ira Weiny <ira.weiny@xxxxxxxxx>
[snip]