From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Kunwu Chan <chentao@kylinos.cn>
Cc: kunwu.chan@hotmail.com, intel-gfx@lists.freedesktop.org,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
daniel@ffwll.ch, rodrigo.vivi@intel.com, airlied@gmail.com
Subject: Re: [Intel-gfx] [PATCH] drm/i915/display: Fix null pointer dereference in intel_dp_aux_wait_done and intel_dp_aux_xfer
Date: Thu, 23 Nov 2023 14:23:16 +0200 [thread overview]
Message-ID: <ZV9ENJIVKztrI2gs@intel.com> (raw)
In-Reply-To: <20231123100431.34453-1-chentao@kylinos.cn>
On Thu, Nov 23, 2023 at 06:04:31PM +0800, Kunwu Chan wrote:
> 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.
How did you reach that conclusion?
>
> Signed-off-by: Kunwu Chan <chentao@kylinos.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
--
Ville Syrjälä
Intel
WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Kunwu Chan <chentao@kylinos.cn>
Cc: tvrtko.ursulin@linux.intel.com, kunwu.chan@hotmail.com,
intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, rodrigo.vivi@intel.com
Subject: Re: [PATCH] drm/i915/display: Fix null pointer dereference in intel_dp_aux_wait_done and intel_dp_aux_xfer
Date: Thu, 23 Nov 2023 14:23:16 +0200 [thread overview]
Message-ID: <ZV9ENJIVKztrI2gs@intel.com> (raw)
In-Reply-To: <20231123100431.34453-1-chentao@kylinos.cn>
On Thu, Nov 23, 2023 at 06:04:31PM +0800, Kunwu Chan wrote:
> 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.
How did you reach that conclusion?
>
> Signed-off-by: Kunwu Chan <chentao@kylinos.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
--
Ville Syrjälä
Intel
WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Kunwu Chan <chentao@kylinos.cn>
Cc: jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com,
rodrigo.vivi@intel.com, tvrtko.ursulin@linux.intel.com,
airlied@gmail.com, daniel@ffwll.ch,
intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, kunwu.chan@hotmail.com
Subject: Re: [PATCH] drm/i915/display: Fix null pointer dereference in intel_dp_aux_wait_done and intel_dp_aux_xfer
Date: Thu, 23 Nov 2023 14:23:16 +0200 [thread overview]
Message-ID: <ZV9ENJIVKztrI2gs@intel.com> (raw)
In-Reply-To: <20231123100431.34453-1-chentao@kylinos.cn>
On Thu, Nov 23, 2023 at 06:04:31PM +0800, Kunwu Chan wrote:
> 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.
How did you reach that conclusion?
>
> Signed-off-by: Kunwu Chan <chentao@kylinos.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
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2023-11-23 12:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-23 10:04 [Intel-gfx] [PATCH] drm/i915/display: Fix null pointer dereference in intel_dp_aux_wait_done and intel_dp_aux_xfer Kunwu Chan
2023-11-23 10:04 ` Kunwu Chan
2023-11-23 10:04 ` Kunwu Chan
2023-11-23 12:23 ` Ville Syrjälä [this message]
2023-11-23 12:23 ` Ville Syrjälä
2023-11-23 12:23 ` Ville Syrjälä
2023-11-27 15:50 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2023-11-28 3:26 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=ZV9ENJIVKztrI2gs@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=airlied@gmail.com \
--cc=chentao@kylinos.cn \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=kunwu.chan@hotmail.com \
--cc=linux-kernel@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.