mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rodolfo Giometti <giometti@enneenne.com>
To: Anders Roxell <anders.roxell@linaro.org>
Cc: linux-kernel@vger.kernel.org, arnd@arndb.de
Subject: Re: [PATCH] scsi: iscsi: Fix IDR memory leak in transport exit
Date: Mon, 7 Jul 2025 13:43:52 +0200	[thread overview]
Message-ID: <5fd4250d-4864-4e42-a75d-366619236808@enneenne.com> (raw)
In-Reply-To: <20250704124934.1071745-1-anders.roxell@linaro.org>

On 04/07/25 14:49, Anders Roxell wrote:
> Add missing idr_destroy() call in iscsi_transport_exit() to properly free
> the iscsi_ep_idr radix tree nodes. Without this, module load/unload cycles
> leak 576-byte radix tree node allocations, detectable by kmemleak as:
> 
> unreferenced object (size 576):
>    backtrace:
>      [<ffffffff81234567>] radix_tree_node_alloc+0xa0/0xf0
>      [<ffffffff81234568>] idr_get_free+0x128/0x280
> 
> The iscsi_ep_idr is initialized via DEFINE_IDR() at line 89 and used
> throughout the iSCSI transport layer for endpoint ID management with
> proper mutex protection via iscsi_ep_idr_mutex. The fix follows the
> documented pattern in lib/idr.c and matches the cleanup approach used
> by other drivers.
> 
> This leak was discovered through comprehensive module testing with cumulative
> kmemleak detection across 10 load/unload iterations per module.

This test has been done on PPS sources too?

> Fixes: 3c6ae371b8a1 ("scsi: iscsi: Release endpoint ID when its freed")

I think that the patch description should be linked to the code it applies to.

Maybe the patch is needed, but if you only modify the PPS code you should also 
provide a description of the problem within the PPS subsystem.

Ciao,

Rodolfo

> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> ---
>   drivers/pps/pps.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
> index 6a02245ea35f..25ed0d44b121 100644
> --- a/drivers/pps/pps.c
> +++ b/drivers/pps/pps.c
> @@ -456,6 +456,7 @@ static void __exit pps_exit(void)
>   {
>   	class_destroy(pps_class);
>   	__unregister_chrdev(pps_major, 0, PPS_MAX_SOURCES, "pps");
> +	idr_destroy(&pps_idr);
>   }
>   
>   static int __init pps_init(void)

-- 
GNU/Linux Solutions                  e-mail: giometti@enneenne.com
Linux Device Driver                          giometti@linux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming


      reply	other threads:[~2025-07-07 11:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-04 12:49 Anders Roxell
2025-07-07 11:43 ` Rodolfo Giometti [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=5fd4250d-4864-4e42-a75d-366619236808@enneenne.com \
    --to=giometti@enneenne.com \
    --cc=anders.roxell@linaro.org \
    --cc=arnd@arndb.de \
    --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

all inboxes | Powered by JetHome®