On 5/13/26 11:32 PM, Chen Pei wrote:
> daxctl_insert_kmod_for_mode() obtains a kmod reference via
> kmod_module_new_from_name() and only stores it in dev->module after a
> successful kmod_module_probe_insert_module() call. On the failure path
> the local reference was returned without being released, leaking one
> reference per failed enable attempt.
> 
> Drop the reference before returning the error code.
> 
> Signed-off-by: Chen Pei <[email protected]>

Reviewed-by: Dave Jiang <[email protected]>


> ---
>  daxctl/lib/libdaxctl.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c
> index 02ae7e5..ffc81eb 100644
> --- a/daxctl/lib/libdaxctl.c
> +++ b/daxctl/lib/libdaxctl.c
> @@ -927,6 +927,7 @@ static int daxctl_insert_kmod_for_mode(struct daxctl_dev 
> *dev,
>                       NULL, NULL, NULL, NULL);
>       if (rc < 0) {
>               err(ctx, "%s: insert failure: %d\n", devname, rc);
> +             kmod_module_unref(kmod);
>               return rc;
>       }
>       dev->module = kmod;


Reply via email to