All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Atharva Tiwari <evepolonium@gmail.com>
Cc: Vaibhav Agarwal <vaibhav.sr@gmail.com>,
	Mark Greer <mgreer@animalcreek.com>,
	Johan Hovold <johan@kernel.org>, Alex Elder <elder@kernel.org>,
	greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: greybus: Remove module from list before freeing in gb_audio_module_release
Date: Mon, 23 Dec 2024 19:05:35 +0100	[thread overview]
Message-ID: <2024122358-vexingly-broadly-7df7@gregkh> (raw)
In-Reply-To: <20241223151112.206908-1-evepolonium@gmail.com>

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@gmail.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

  reply	other threads:[~2024-12-23 18:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-23 15:11 [PATCH] staging: greybus: Remove module from list before freeing in gb_audio_module_release Atharva Tiwari
2024-12-23 18:05 ` Greg Kroah-Hartman [this message]
2024-12-24  5:19   ` [PATCH] staging: greybus: Remove Module " Atharva Tiwari
2024-12-24  5:43     ` Greg KH
2025-01-06  9:51     ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2024122358-vexingly-broadly-7df7@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=elder@kernel.org \
    --cc=evepolonium@gmail.com \
    --cc=greybus-dev@lists.linaro.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mgreer@animalcreek.com \
    --cc=vaibhav.sr@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.