From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-tegra@vger.kernel.org>, <thierry.reding@gmail.com>,
<airlied@gmail.com>, <daniel@ffwll.ch>, <mperttunen@nvidia.com>
Cc: <yangyingliang@huawei.com>
Subject: [PATCH resend] gpu: host1x: fix error return code in host1x_memory_context_list_init()
Date: Thu, 24 Nov 2022 16:05:59 +0800 [thread overview]
Message-ID: <20221124080559.3592650-1-yangyingliang@huawei.com> (raw)
If context device has no IOMMU, the 'cdl->devs' is freed in error path,
but host1x_memory_context_list_init() doesn't return an error code, so
the module can be loaded successfully, when it's unloading, the
host1x_memory_context_list_free() is called in host1x_remove(), it will
cause double free. Return an error code to fix this.
Fixes: 8aa5bcb61612 ("gpu: host1x: Add context device management code")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
The previous patch link:
https://lore.kernel.org/lkml/20220714031123.2154506-1-yangyingliang@huawei.com/
---
drivers/gpu/host1x/context.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/host1x/context.c b/drivers/gpu/host1x/context.c
index b08cf11f9a66..5cf9b98bedd0 100644
--- a/drivers/gpu/host1x/context.c
+++ b/drivers/gpu/host1x/context.c
@@ -74,6 +74,7 @@ int host1x_memory_context_list_init(struct host1x *host1x)
if (!fwspec || !device_iommu_mapped(&ctx->dev)) {
dev_err(host1x->dev, "Context device %d has no IOMMU!\n", i);
device_del(&ctx->dev);
+ err = -EOPNOTSUPP;
goto del_devices;
}
--
2.25.1
next reply other threads:[~2022-11-24 8:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-24 8:05 Yang Yingliang [this message]
2022-11-25 16:00 ` [PATCH resend] gpu: host1x: fix error return code in host1x_memory_context_list_init() Mikko Perttunen
2022-11-26 2:39 ` Yang Yingliang
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=20221124080559.3592650-1-yangyingliang@huawei.com \
--to=yangyingliang@huawei.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=linux-tegra@vger.kernel.org \
--cc=mperttunen@nvidia.com \
--cc=thierry.reding@gmail.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