mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Anders Roxell <anders.roxell@linaro.org>,
	lduncan@suse.com, cleech@redhat.com, michael.christie@oracle.com,
	James.Bottomley@HansenPartnership.com,
	martin.petersen@oracle.com
Cc: open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org, arnd@arndb.de
Subject: Re: [PATCH] pps: Fix IDR memory leak in module exit
Date: Tue, 8 Jul 2025 11:35:47 +0200	[thread overview]
Message-ID: <c72cc8b7-f55d-4691-9161-c20d07fde99e@suse.de> (raw)
In-Reply-To: <20250704125536.1091187-1-anders.roxell@linaro.org>

On 7/4/25 14:55, Anders Roxell wrote:
> Add missing idr_destroy() call in pps_exit() to properly free the pps_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 pps_idr is initialized via DEFINE_IDR() at line 32 and used throughout
> the PPS subsystem for device ID management. The fix follows the documented
> pattern in lib/idr.c and matches the cleanup approach used by other drivers
> such as drivers/uio/uio.c.
> 
> This leak was discovered through comprehensive module testing with cumulative
> kmemleak detection across 10 load/unload iterations per module.
> 
> Fixes: eae9d2ba0cfc ("LinuxPPS: core support")
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> ---
>   drivers/scsi/scsi_transport_iscsi.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
> index c75a806496d6..adbedb58930d 100644
> --- a/drivers/scsi/scsi_transport_iscsi.c
> +++ b/drivers/scsi/scsi_transport_iscsi.c
> @@ -5024,6 +5024,7 @@ static void __exit iscsi_transport_exit(void)
>   	class_unregister(&iscsi_endpoint_class);
>   	class_unregister(&iscsi_iface_class);
>   	class_unregister(&iscsi_transport_class);
> +	idr_destroy(&iscsi_ep_idr);
>   }
>   
>   module_init(iscsi_transport_init);

Errm.
The description doesn't match the patch.
Care to fix it up?

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare@suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich

      reply	other threads:[~2025-07-08  9:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-04 12:55 Anders Roxell
2025-07-08  9:35 ` Hannes Reinecke [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=c72cc8b7-f55d-4691-9161-c20d07fde99e@suse.de \
    --to=hare@suse.de \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=anders.roxell@linaro.org \
    --cc=arnd@arndb.de \
    --cc=cleech@redhat.com \
    --cc=lduncan@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michael.christie@oracle.com \
    --cc=open-iscsi@googlegroups.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 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®