The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>
Cc: ayaanmirza85@gmail.com, dakr@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] drivers/base: fix iterator cleanup in attribute_container_find_class_device (v2)
Date: Fri, 28 Feb 2025 23:34:16 -0800	[thread overview]
Message-ID: <2025022819-pushing-virtual-9b85@gregkh> (raw)
In-Reply-To: <20250227124417.132020-4-ayaanmirzabaig85@gmail.com>

On Thu, Feb 27, 2025 at 06:11:29PM +0530, Ayaan Mirza Baig wrote:
> This patch fixes a long-standing FIXME by refactoring
> the function to ensure klist_iter_exit() is always
> invoked once via a unified cleanup path
> 
> The patch has been tested thoroughly with a minimal
> Debain System and scsi devices and GDB.
> 
> Tested-by: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>
> Signed-off-by: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>

No need to duplicate this here, if you sign-off it's implicit that you
tested it :)

> ---
>  drivers/base/attribute_container.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/base/attribute_container.c b/drivers/base/attribute_container.c
> index 69637b2ec3bc..fbf7fd45651e 100644
> --- a/drivers/base/attribute_container.c
> +++ b/drivers/base/attribute_container.c
> @@ -492,12 +492,11 @@ attribute_container_find_class_device(struct attribute_container *cont,
>  	klist_for_each_entry(ic, &cont->containers, node, &iter) {
>  		if (ic->classdev.parent == dev) {
>  			cdev = &ic->classdev;
> -			/* FIXME: must exit iterator then break */
> -			klist_iter_exit(&iter);
> -			break;
> +			goto out;
>  		}
>  	}
> -
> +out:
> +	klist_iter_exit(&iter);

Are you sure this actually does something different?  Why is the FIXME
there and why does this "simple" change solve the issue?  I don't
understand how this change resolves the problem.

In other words, you're going to have to document this a lot better in
the changelog message please.

thanks,

greg k-h

      reply	other threads:[~2025-03-01  7:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 18:27 [PATCH] drivers/base: fix iterator cleanup in attribute_container Ayaan Mirza Baig
2025-02-26 19:16 ` Greg KH
2025-02-27 12:41   ` [PATCH 1/2] drivers/base: fix checkpatch.pl warnings in attribute_container.c (v2) Ayaan Mirza Baig
2025-03-01  7:31     ` Greg KH
2025-02-27 12:41   ` [PATCH 2/2] drivers/base: fix iterator cleanup in attribute_container_find_class_device (v2) Ayaan Mirza Baig
2025-03-01  7:34     ` Greg KH [this message]

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=2025022819-pushing-virtual-9b85@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=ayaanmirza85@gmail.com \
    --cc=ayaanmirzabaig85@gmail.com \
    --cc=dakr@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox