Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Cc: James.Bottomley@hansenpartnership.com, don.brace@microchip.com,
	martin.petersen@oracle.com, jbottomley@parallels.com,
	scameron@beardog.cce.hp.com, storagedev@microchip.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] hpsa: fix a memory leak in hpsa_find_cfgtables()
Date: Wed, 7 Jan 2026 10:06:41 +0100	[thread overview]
Message-ID: <2026010718-upchuck-nimbly-6ffb@gregkh> (raw)
In-Reply-To: <20260107085617.3391860-1-lihaoxiang@isrc.iscas.ac.cn>

On Wed, Jan 07, 2026 at 04:56:17PM +0800, Haoxiang Li wrote:
> If write_driver_ver_to_cfgtable() fails, add iounmap() to
> release the memory allocated by remap_pci_mem().

How did you find this bug?  You always need to document the tool you are
using.

> 
> Fixes: 580ada3c1e2f ("[SCSI] hpsa: do a better job of detecting controller reset failure")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
> ---
>  drivers/scsi/hpsa.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index 3654b12c5d5a..4cc129d2d6f2 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -7646,8 +7646,11 @@ static int hpsa_find_cfgtables(struct ctlr_info *h)
>  		return -ENOMEM;
>  	}
>  	rc = write_driver_ver_to_cfgtable(h->cfgtable);
> -	if (rc)
> +	if (rc) {
> +		iounmap(h->cfgtable);
> +		h->cfgtable = NULL;

Shouldn't you just call hpsa_free_cfgtables() instead?

thanks,

greg k-h

      reply	other threads:[~2026-01-07  9:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-07  8:56 [PATCH] hpsa: fix a memory leak in hpsa_find_cfgtables() Haoxiang Li
2026-01-07  9:06 ` 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=2026010718-upchuck-nimbly-6ffb@gregkh \
    --to=greg@kroah.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=don.brace@microchip.com \
    --cc=jbottomley@parallels.com \
    --cc=lihaoxiang@isrc.iscas.ac.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=scameron@beardog.cce.hp.com \
    --cc=stable@vger.kernel.org \
    --cc=storagedev@microchip.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