From: "Ceraolo Spurio, Daniele" <daniele.ceraolospurio@intel.com>
To: Dan Carpenter <error27@gmail.com>,
Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, kernel-janitors@vger.kernel.org,
Daniel Vetter <daniel@ffwll.ch>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
David Airlie <airlied@gmail.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/uc: Fix double free bug
Date: Tue, 29 Nov 2022 08:11:51 -0800 [thread overview]
Message-ID: <05af5930-2b7d-cf23-2cc7-abe0a390f890@intel.com> (raw)
In-Reply-To: <Y4XUuyFi3fr354sP@kili>
On 11/29/2022 1:45 AM, Dan Carpenter wrote:
> The "fw" pointer is freed again in the clean up code at the end of the
> function. Set it to NULL here to prevent a double free.
>
> Fixes: 016241168dc5 ("drm/i915/uc: use different ggtt pin offsets for uc loads")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
This should be an impossible error in normal behavior (the fallback code
should select a new valid FW file before we get to the cleanup), but a
user can shot themselves in the foot if they override the firmware path
to an invalid file, because that disables the fallback, so:
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Daniele
> ---
> drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
> index 0c80ba51a4bd..8aa9bcae8e72 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
> @@ -585,6 +585,7 @@ int intel_uc_fw_fetch(struct intel_uc_fw *uc_fw)
>
> /* try to find another blob to load */
> release_firmware(fw);
> + fw = NULL;
> err = -ENOENT;
> }
>
WARNING: multiple messages have this Message-ID (diff)
From: "Ceraolo Spurio, Daniele" <daniele.ceraolospurio@intel.com>
To: Dan Carpenter <error27@gmail.com>,
Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
"John Harrison" <John.C.Harrison@intel.com>,
Matt Roper <matthew.d.roper@intel.com>,
<intel-gfx@lists.freedesktop.org>,
<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] drm/i915/uc: Fix double free bug
Date: Tue, 29 Nov 2022 08:11:51 -0800 [thread overview]
Message-ID: <05af5930-2b7d-cf23-2cc7-abe0a390f890@intel.com> (raw)
In-Reply-To: <Y4XUuyFi3fr354sP@kili>
On 11/29/2022 1:45 AM, Dan Carpenter wrote:
> The "fw" pointer is freed again in the clean up code at the end of the
> function. Set it to NULL here to prevent a double free.
>
> Fixes: 016241168dc5 ("drm/i915/uc: use different ggtt pin offsets for uc loads")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
This should be an impossible error in normal behavior (the fallback code
should select a new valid FW file before we get to the cleanup), but a
user can shot themselves in the foot if they override the firmware path
to an invalid file, because that disables the fallback, so:
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Daniele
> ---
> drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
> index 0c80ba51a4bd..8aa9bcae8e72 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
> @@ -585,6 +585,7 @@ int intel_uc_fw_fetch(struct intel_uc_fw *uc_fw)
>
> /* try to find another blob to load */
> release_firmware(fw);
> + fw = NULL;
> err = -ENOENT;
> }
>
next prev parent reply other threads:[~2022-11-29 16:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-29 9:45 [Intel-gfx] [PATCH] drm/i915/uc: Fix double free bug Dan Carpenter
2022-11-29 9:45 ` Dan Carpenter
2022-11-29 16:11 ` Ceraolo Spurio, Daniele [this message]
2022-11-29 16:11 ` Ceraolo Spurio, Daniele
2022-12-01 21:03 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2022-12-02 11:34 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
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=05af5930-2b7d-cf23-2cc7-abe0a390f890@intel.com \
--to=daniele.ceraolospurio@intel.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=error27@gmail.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=rodrigo.vivi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.