[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231123100431.34453-1-chentao@kylinos.cn>
Date: Thu, 23 Nov 2023 18:04:31 +0800
From: Kunwu Chan <chentao@...inos.cn>
To: jani.nikula@...ux.intel.com, joonas.lahtinen@...ux.intel.com,
rodrigo.vivi@...el.com, tvrtko.ursulin@...ux.intel.com,
airlied@...il.com, daniel@...ll.ch
Cc: kunwu.chan@...mail.com, intel-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
Kunwu Chan <chentao@...inos.cn>
Subject: [PATCH] drm/i915/display: Fix null pointer dereference in intel_dp_aux_wait_done and intel_dp_aux_xfer
kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure. When "intel_dp->aux.name" is NULL,
these error messages will trigger the null pointer dereference issue.
Signed-off-by: Kunwu Chan <chentao@...inos.cn>
---
drivers/gpu/drm/i915/display/intel_dp_aux.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux.c b/drivers/gpu/drm/i915/display/intel_dp_aux.c
index 2e2af71bcd5a..398c9064eb09 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_aux.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_aux.c
@@ -67,7 +67,7 @@ intel_dp_aux_wait_done(struct intel_dp *intel_dp)
if (ret == -ETIMEDOUT)
drm_err(&i915->drm,
"%s: did not complete or timeout within %ums (status 0x%08x)\n",
- intel_dp->aux.name, timeout_ms, status);
+ intel_dp->aux.name ? intel_dp->aux.name : "", timeout_ms, status);
return status;
}
@@ -302,7 +302,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
if (status != intel_dp->aux_busy_last_status) {
drm_WARN(&i915->drm, 1,
"%s: not started (status 0x%08x)\n",
- intel_dp->aux.name, status);
+ intel_dp->aux.name ? intel_dp->aux.name : "", status);
intel_dp->aux_busy_last_status = status;
}
@@ -362,7 +362,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
if ((status & DP_AUX_CH_CTL_DONE) == 0) {
drm_err(&i915->drm, "%s: not done (status 0x%08x)\n",
- intel_dp->aux.name, status);
+ intel_dp->aux.name ? intel_dp->aux.name : "", status);
ret = -EBUSY;
goto out;
}
@@ -374,7 +374,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
*/
if (status & DP_AUX_CH_CTL_RECEIVE_ERROR) {
drm_err(&i915->drm, "%s: receive error (status 0x%08x)\n",
- intel_dp->aux.name, status);
+ intel_dp->aux.name ? intel_dp->aux.name : "", status);
ret = -EIO;
goto out;
}
@@ -385,7 +385,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
*/
if (status & DP_AUX_CH_CTL_TIME_OUT_ERROR) {
drm_dbg_kms(&i915->drm, "%s: timeout (status 0x%08x)\n",
- intel_dp->aux.name, status);
+ intel_dp->aux.name ? intel_dp->aux.name : "", status);
ret = -ETIMEDOUT;
goto out;
}
@@ -401,7 +401,7 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
if (recv_bytes == 0 || recv_bytes > 20) {
drm_dbg_kms(&i915->drm,
"%s: Forbidden recv_bytes = %d on aux transaction\n",
- intel_dp->aux.name, recv_bytes);
+ intel_dp->aux.name ? intel_dp->aux.name : "", recv_bytes);
ret = -EBUSY;
goto out;
}
--
2.34.1
Powered by blists - more mailing lists