[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHUa44HPpS0QVwtSGhOJDK-t+0v26V6kdXwERcNM1fbkBxK--w@mail.gmail.com>
Date: Wed, 28 May 2025 17:31:59 +0200
From: Jens Wiklander <jens.wiklander@...aro.org>
To: Sudeep Holla <sudeep.holla@....com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Jérôme Forissier <jerome.forissier@...aro.org>
Subject: Re: [PATCH 1/3] firmware: arm_ffa: Fix memory leak by freeing
notifier callback node
On Wed, May 28, 2025 at 10:50 AM Sudeep Holla <sudeep.holla@....com> wrote:
>
> Commit e0573444edbf ("firmware: arm_ffa: Add interfaces to request
> notification callbacks") adds support for notifier callbacks by allocating
> and inserting a callback node into a hashtable during registration of
> notifiers. However, during unregistration, the code only removes the
> node from the hashtable without freeing the associated memory, resulting
> in a memory leak.
>
> Resolve the memory leak issue by ensuring the allocated notifier callback
> node is properly freed after it is removed from the hashtable entry.
>
> Fixes: e0573444edbf ("firmware: arm_ffa: Add interfaces to request notification callbacks")
> Signed-off-by: Sudeep Holla <sudeep.holla@....com>
> ---
> drivers/firmware/arm_ffa/driver.c | 1 +
> 1 file changed, 1 insertion(+)
Reviewed-by: Jens Wiklander <jens.wiklander@...aro.org>
Cheers,
Jens
>
> diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
> index fe55613a8ea993378474671d3c5756309da34fbc..6f75cdf29720993b1cd95eb7d3a36d01b0fdd1de 100644
> --- a/drivers/firmware/arm_ffa/driver.c
> +++ b/drivers/firmware/arm_ffa/driver.c
> @@ -1284,6 +1284,7 @@ update_notifier_cb(struct ffa_device *dev, int notify_id, void *cb,
> hash_add(drv_info->notifier_hash, &cb_info->hnode, notify_id);
> } else {
> hash_del(&cb_info->hnode);
> + kfree(cb_info);
> }
>
> return 0;
>
> --
> 2.34.1
>
Powered by blists - more mailing lists