From: Lyude Paul <lyude@redhat.com>
To: Wayne Lin <Wayne.Lin@amd.com>,
dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
Cc: jerry.zuo@amd.com, mikita.lipski@amd.com, harry.wentland@amd.com,
Nicholas.Kazlauskas@amd.com, stable@vger.kernel.org
Subject: Re: [PATCH] drm/dp_mst: Avoid NULL pointer dereference
Date: Fri, 03 Jan 2020 15:35:12 -0500 [thread overview]
Message-ID: <cfb5d28df84df7d3ce20656ca40be65713d5bdb0.camel@redhat.com> (raw)
In-Reply-To: <20191226023151.5448-1-Wayne.Lin@amd.com>
Back from the holidays!
Reviewed-by: Lyude Paul <lyude@redhat.com>
Do you need me to push this to drm-misc?
On Thu, 2019-12-26 at 10:31 +0800, Wayne Lin wrote:
> [Why]
> Found kernel NULL pointer dereference under the below situation:
>
> src — HDMI_Monitor src — HDMI_Monitor
> e.g.: \ =>
> MSTB — MSTB (unplug) MSTB — MSTB
>
> When display 1 HDMI and 2 DP daisy chain monitors, unplugging the dp
> cable connected to source causes kernel NULL pointer dereference at
> drm_dp_mst_atomic_check_bw_limit(). When calculating pbn_limit, if
> branch is null, accessing "&branch->ports" causes the problem.
>
> [How]
> Judge branch is null or not at the beginning. If it is null, return 0.
>
> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
> Cc: stable@vger.kernel.org
> ---
> drivers/gpu/drm/drm_dp_mst_topology.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 7d2d31eaf003..a6473e3ab448 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -4707,6 +4707,9 @@ int drm_dp_mst_atomic_check_bw_limit(struct
> drm_dp_mst_branch *branch,
> struct drm_dp_vcpi_allocation *vcpi;
> int pbn_limit = 0, pbn_used = 0;
>
> + if (!branch)
> + return 0;
> +
> list_for_each_entry(port, &branch->ports, next) {
> if (port->mstb)
> if (drm_dp_mst_atomic_check_bw_limit(port->mstb,
> mst_state))
--
Cheers,
Lyude Paul
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Lyude Paul <lyude@redhat.com>
To: Wayne Lin <Wayne.Lin@amd.com>,
dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
Cc: jerry.zuo@amd.com, mikita.lipski@amd.com,
Nicholas.Kazlauskas@amd.com, stable@vger.kernel.org
Subject: Re: [PATCH] drm/dp_mst: Avoid NULL pointer dereference
Date: Fri, 03 Jan 2020 15:35:12 -0500 [thread overview]
Message-ID: <cfb5d28df84df7d3ce20656ca40be65713d5bdb0.camel@redhat.com> (raw)
In-Reply-To: <20191226023151.5448-1-Wayne.Lin@amd.com>
Back from the holidays!
Reviewed-by: Lyude Paul <lyude@redhat.com>
Do you need me to push this to drm-misc?
On Thu, 2019-12-26 at 10:31 +0800, Wayne Lin wrote:
> [Why]
> Found kernel NULL pointer dereference under the below situation:
>
> src — HDMI_Monitor src — HDMI_Monitor
> e.g.: \ =>
> MSTB — MSTB (unplug) MSTB — MSTB
>
> When display 1 HDMI and 2 DP daisy chain monitors, unplugging the dp
> cable connected to source causes kernel NULL pointer dereference at
> drm_dp_mst_atomic_check_bw_limit(). When calculating pbn_limit, if
> branch is null, accessing "&branch->ports" causes the problem.
>
> [How]
> Judge branch is null or not at the beginning. If it is null, return 0.
>
> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
> Cc: stable@vger.kernel.org
> ---
> drivers/gpu/drm/drm_dp_mst_topology.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 7d2d31eaf003..a6473e3ab448 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -4707,6 +4707,9 @@ int drm_dp_mst_atomic_check_bw_limit(struct
> drm_dp_mst_branch *branch,
> struct drm_dp_vcpi_allocation *vcpi;
> int pbn_limit = 0, pbn_used = 0;
>
> + if (!branch)
> + return 0;
> +
> list_for_each_entry(port, &branch->ports, next) {
> if (port->mstb)
> if (drm_dp_mst_atomic_check_bw_limit(port->mstb,
> mst_state))
--
Cheers,
Lyude Paul
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Lyude Paul <lyude@redhat.com>
To: Wayne Lin <Wayne.Lin@amd.com>,
dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
Cc: Nicholas.Kazlauskas@amd.com, harry.wentland@amd.com,
mikita.lipski@amd.com, jerry.zuo@amd.com, stable@vger.kernel.org
Subject: Re: [PATCH] drm/dp_mst: Avoid NULL pointer dereference
Date: Fri, 03 Jan 2020 15:35:12 -0500 [thread overview]
Message-ID: <cfb5d28df84df7d3ce20656ca40be65713d5bdb0.camel@redhat.com> (raw)
In-Reply-To: <20191226023151.5448-1-Wayne.Lin@amd.com>
Back from the holidays!
Reviewed-by: Lyude Paul <lyude@redhat.com>
Do you need me to push this to drm-misc?
On Thu, 2019-12-26 at 10:31 +0800, Wayne Lin wrote:
> [Why]
> Found kernel NULL pointer dereference under the below situation:
>
> src — HDMI_Monitor src — HDMI_Monitor
> e.g.: \ =>
> MSTB — MSTB (unplug) MSTB — MSTB
>
> When display 1 HDMI and 2 DP daisy chain monitors, unplugging the dp
> cable connected to source causes kernel NULL pointer dereference at
> drm_dp_mst_atomic_check_bw_limit(). When calculating pbn_limit, if
> branch is null, accessing "&branch->ports" causes the problem.
>
> [How]
> Judge branch is null or not at the beginning. If it is null, return 0.
>
> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
> Cc: stable@vger.kernel.org
> ---
> drivers/gpu/drm/drm_dp_mst_topology.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 7d2d31eaf003..a6473e3ab448 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -4707,6 +4707,9 @@ int drm_dp_mst_atomic_check_bw_limit(struct
> drm_dp_mst_branch *branch,
> struct drm_dp_vcpi_allocation *vcpi;
> int pbn_limit = 0, pbn_used = 0;
>
> + if (!branch)
> + return 0;
> +
> list_for_each_entry(port, &branch->ports, next) {
> if (port->mstb)
> if (drm_dp_mst_atomic_check_bw_limit(port->mstb,
> mst_state))
--
Cheers,
Lyude Paul
next prev parent reply other threads:[~2020-01-03 20:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-26 2:31 [PATCH] drm/dp_mst: Avoid NULL pointer dereference Wayne Lin
2019-12-26 2:31 ` Wayne Lin
2019-12-26 2:31 ` Wayne Lin
2019-12-26 15:04 ` Lipski, Mikita
2019-12-26 15:04 ` Lipski, Mikita
2019-12-26 15:04 ` Lipski, Mikita
2020-01-03 20:35 ` Lyude Paul [this message]
2020-01-03 20:35 ` Lyude Paul
2020-01-03 20:35 ` Lyude Paul
2020-01-06 7:34 ` 回覆: " Lin, Wayne
2020-01-06 7:34 ` Lin, Wayne
2020-01-06 7:34 ` Lin, Wayne
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=cfb5d28df84df7d3ce20656ca40be65713d5bdb0.camel@redhat.com \
--to=lyude@redhat.com \
--cc=Nicholas.Kazlauskas@amd.com \
--cc=Wayne.Lin@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=jerry.zuo@amd.com \
--cc=mikita.lipski@amd.com \
--cc=stable@vger.kernel.org \
/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.