[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2024122358-vexingly-broadly-7df7@gregkh>
Date: Mon, 23 Dec 2024 19:05:35 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Atharva Tiwari <evepolonium@...il.com>
Cc: Vaibhav Agarwal <vaibhav.sr@...il.com>,
Mark Greer <mgreer@...malcreek.com>,
Johan Hovold <johan@...nel.org>, Alex Elder <elder@...nel.org>,
greybus-dev@...ts.linaro.org, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: greybus: Remove module from list before freeing
in gb_audio_module_release
On Mon, Dec 23, 2024 at 08:41:12PM +0530, Atharva Tiwari wrote:
> Previously,the module was freed without detaching it from the list which could lead to memory leak
> this patch uses list_del to safely remove the module from the list
>
> Signed-off-by: Atharva Tiwari <evepolonium@...il.com>
> ---
> drivers/staging/greybus/audio_manager_module.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/greybus/audio_manager_module.c b/drivers/staging/greybus/audio_manager_module.c
> index 4a4dfb42f50f..7e52c3f95692 100644
> --- a/drivers/staging/greybus/audio_manager_module.c
> +++ b/drivers/staging/greybus/audio_manager_module.c
> @@ -69,7 +69,8 @@ static void gb_audio_module_release(struct kobject *kobj)
> struct gb_audio_manager_module *module = to_gb_audio_module(kobj);
>
> pr_info("Destroying audio module #%d\n", module->id);
> - /* TODO -> delete from list */
> + if (module->list.prev && module->list.next)
For lists, you really shouldn't poke around in the prev and next
pointers, right?
Have you tested this? This feels like an odd change, is it a real
system that is using this code anymore?
thanks,
greg k-h
Powered by blists - more mailing lists