Linux Media Controller development
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Manik Bajpai <manik.bajpai@intel.com>
Cc: linux-media@vger.kernel.org, antti.laakso@linux.intel.com,
	sarang.sapre@intel.com
Subject: Re: [PATCH v2 1/4] media: ipu6: Free boot config on queue memory alloc failure
Date: Wed, 30 Sep 2026 11:53:37 +0300	[thread overview]
Message-ID: <arzOEbZugSnqCbkW@kekkonen.localdomain> (raw)
In-Reply-To: <20260929083130.88381-2-manik.bajpai@intel.com>

Hi Manik,

On Tue, Sep 29, 2026 at 02:01:27PM +0530, Manik Bajpai wrote:
> If the queue_mem allocation in ipu7_init_boot_config() fails, the
> function returned -ENOMEM without freeing the boot_config buffer it
> had already allocated. The current caller happens to clean up via
> ipu7_fw_isys_cleanup() -> ipu7_release_boot_config() on any failure
> from this function, so this is not an active leak today, but
> ipu7_init_boot_config() should not rely on a specific caller undoing
> its partial allocations.
> 
> Call the existing ipu7_release_boot_config() helper before returning,
> so the function cleans up after itself on its own error path,
> independent of what the caller does.
> 
> Assisted-by: Claude:claude-sonnet-5
> Signed-off-by: Manik Bajpai <manik.bajpai@intel.com>
> ---
>  drivers/media/pci/intel/ipu6/ipu7-boot.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/media/pci/intel/ipu6/ipu7-boot.c b/drivers/media/pci/intel/ipu6/ipu7-boot.c
> index 5bd5281ec107..225f802cfd1c 100644
> --- a/drivers/media/pci/intel/ipu6/ipu7-boot.c
> +++ b/drivers/media/pci/intel/ipu6/ipu7-boot.c
> @@ -246,6 +246,7 @@ int ipu7_init_boot_config(struct ipu6_bus_device *adev,
>  					  GFP_KERNEL, 0);
>  	if (!fwctx->queue_mem) {
>  		dev_err(dev, "Failed to allocate queue memory.\n");
> +		ipu7_release_boot_config(adev);

I believe on error, the caller already calls ipu7_fw_isys_cleanup() that
includes a call to ipu7_release_boot_config().

The rest of the patches seem fine to me.

>  		return -ENOMEM;
>  	}
>  	fwctx->queue_mem_size = total_queue_size_aligned;

-- 
Kind regards,

Sakari Ailus

  reply	other threads:[~2026-09-30  8:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 11:56 [PATCH v1 0/4] media: ipu6: A few defensive fixes for ipu7 buttress, fw-com and mmu paths Manik Bajpai
2026-09-28 11:56 ` [PATCH v1 1/4] media: ipu6: Free boot config on queue memory alloc failure Manik Bajpai
2026-09-28 11:56 ` [PATCH v1 2/4] media: ipu6: Always run cleanup in ipu7 power on/off on timeout Manik Bajpai
2026-09-28 11:56 ` [PATCH v1 3/4] media: ipu6: Validate fw-com queue indices before use Manik Bajpai
2026-09-28 11:56 ` [PATCH v1 4/4] media: ipu6: Fix NULL deref in ipu6_mmu_iova_to_phys() Manik Bajpai
2026-09-28 12:08   ` Sakari Ailus
2026-09-29  8:31     ` [PATCH v2 0/4] media: ipu6: A few defensive fixes for ipu7 buttress, fw-com and mmu paths Manik Bajpai
2026-09-29  8:31       ` [PATCH v2 1/4] media: ipu6: Free boot config on queue memory alloc failure Manik Bajpai
2026-09-30  8:53         ` Sakari Ailus [this message]
2026-09-29  8:31       ` [PATCH v2 2/4] media: ipu6: Always run cleanup in ipu7 power on/off on timeout Manik Bajpai
2026-09-30 13:17         ` Antti Laakso
2026-09-29  8:31       ` [PATCH v2 3/4] media: ipu6: Validate fw-com queue indices before use Manik Bajpai
2026-09-29  8:31       ` [PATCH v2 4/4] media: ipu6: Fix NULL deref in ipu6_mmu_iova_to_phys() Manik Bajpai

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=arzOEbZugSnqCbkW@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=antti.laakso@linux.intel.com \
    --cc=linux-media@vger.kernel.org \
    --cc=manik.bajpai@intel.com \
    --cc=sarang.sapre@intel.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