<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<br>
<div class="moz-cite-prefix">在 2025/5/30 17:54, 00 1970 写道:<br>
</div>
<blockquote type="cite"
cite="mid:20250530095432.1206966-5-shiyongbang@huawei.com">
<pre wrap="" class="moz-quote-pre">From: Baihan Li <a class="moz-txt-link-rfc2396E" href="mailto:libaihan@huawei.com"><libaihan@huawei.com></a>
When hibmc loaded failed, the driver use hibmc_unload to free the
resource, but the mutexes in mode.config are not init, which will
access an NULL pointer.
Fixes: b3df5e65cc03 ("drm/hibmc: Drop drm_vblank_cleanup")
Reported-by: <a class="moz-txt-link-abbreviated" href="mailto:oushixiong1025@163.com">oushixiong1025@163.com</a>
Signed-off-by: Baihan Li <a class="moz-txt-link-rfc2396E" href="mailto:libaihan@huawei.com"><libaihan@huawei.com></a>
---
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index 4cdcc34070ee..ac552c339671 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -319,13 +319,13 @@ static int hibmc_load(struct drm_device *dev)
ret = hibmc_hw_init(priv);
if (ret)
- goto err;
+ return ret;
ret = drmm_vram_helper_init(dev, pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0));
if (ret) {
drm_err(dev, "Error initializing VRAM MM; %d\n", ret);
- goto err;
+ return ret;</pre>
</blockquote>
<p>The mutexes in mode.config are <span
style="color: rgb(64, 64, 64); font-family: quote-cjk-patch, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", Oxygen, "Open Sans", sans-serif; font-size: 16.002px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">initialized</span>
when calling hibmc_kms_init(), <br>
if calling hibmc_kms_init() failed it also need to return.</p>
<p>You may want to look at the following patch:<br>
<a href="https://lkml.org/lkml/2025/5/20/331">LKML:
oushixiong1025@163 ...: [PATCH] drm/hisilicon: Fix a NULL
pointer access when hibmc_load failed</a></p>
<p>Reported-by: Shixiong Ou <a class="moz-txt-link-rfc2396E" href="mailto:oushixiong@kylinos.cn"><oushixiong@kylinos.cn></a></p>
<p>Thanks and Regards,<br>
Shixiong Ou.<br>
</p>
<blockquote type="cite"
cite="mid:20250530095432.1206966-5-shiyongbang@huawei.com">
<pre wrap="" class="moz-quote-pre">
}
ret = hibmc_kms_init(priv);
</pre>
</blockquote>
</body>
</html>