From: Suyuan Wang via B4 Relay <devnull+shyckless.gmail.com@kernel.org>
To: alessio.belle@imgtec.com, luigi.santivetti@imgtec.com
Cc: donald.robson@imgtec.com, mripard@kernel.org,
dri-devel@lists.freedesktop.org,
maarten.lankhorst@linux.intel.com, airlied@gmail.com,
simona@ffwll.ch, tzimmermann@suse.de,
linux-kernel@vger.kernel.org, imagination@lists.freedesktop.org
Subject: [PATCH v2 1/2] drm/imagination: Destroy the common FW object when HWRT data setup fails
Date: Sat, 21 Nov 2026 15:47:19 +0000 [thread overview]
Message-ID: <20261121-pvr-hwrt-common-v2-1-9f53bdf954de@gmail.com> (raw)
In-Reply-To: <20261121-pvr-hwrt-common-v2-0-9f53bdf954de@gmail.com>
From: Suyuan Wang <stevewong@hust.edu.cn>
If hwrt_data_init_fw_structure() fails in pvr_hwrt_dataset_create(),
the error path frees the per-data FW structures and then jumps straight
to err_fini_kernel_structure, skipping hwrt_fini_common_fw_structure().
The common FW object created just before is never destroyed, and its
init callback data is the hwrt that is then freed:
err = pvr_fw_object_create(pvr_dev, ...,
hwrtdata_common_init, hwrt,
&hwrt->common_fw_obj);
Besides leaking the object, this leaves it on the device's FW object
list, so a later pvr_fw_hard_reset() calls hwrtdata_common_init() with
the freed hwrt, and pvr_fw_fini() warns that the list is not empty.
Destroy the common FW object on that path, in the same order as
pvr_hwrt_dataset_release().
Found with a static analysis tool and checked by hand.
Fixes: f1f55ed3ffe4 ("drm/imagination: Fixed oops when misusing ioctl CREATE_HWRT_DATASET")
Cc: stable@vger.kernel.org
Co-developed-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
Signed-off-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
Signed-off-by: Suyuan Wang <stevewong@hust.edu.cn>
---
drivers/gpu/drm/imagination/pvr_hwrt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/imagination/pvr_hwrt.c b/drivers/gpu/drm/imagination/pvr_hwrt.c
index 3f7c4346c52c..aa25f6adaa3b 100644
--- a/drivers/gpu/drm/imagination/pvr_hwrt.c
+++ b/drivers/gpu/drm/imagination/pvr_hwrt.c
@@ -483,6 +483,8 @@ pvr_hwrt_dataset_create(struct pvr_file *pvr_file,
while (--i >= 0)
hwrt_data_fini_fw_structure(hwrt, i);
+ hwrt_fini_common_fw_structure(hwrt);
+
err_fini_kernel_structure:
hwrt_fini_kernel_structure(hwrt);
--
2.34.1
next prev parent reply other threads:[~2026-11-21 15:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 15:47 [PATCH v2 0/2] drm/imagination: Fix leaks in HWRT data set handling Suyuan Wang via B4 Relay
2026-11-21 15:47 ` Suyuan Wang via B4 Relay [this message]
2026-11-21 15:47 ` [PATCH v2 2/2] drm/imagination: Don't truncate the layer count in max_rts Suyuan Wang via B4 Relay
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=20261121-pvr-hwrt-common-v2-1-9f53bdf954de@gmail.com \
--to=devnull+shyckless.gmail.com@kernel.org \
--cc=airlied@gmail.com \
--cc=alessio.belle@imgtec.com \
--cc=donald.robson@imgtec.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=imagination@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luigi.santivetti@imgtec.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=shyckless@gmail.com \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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®