[Intel-gfx] [PATCH] drm/i915: Avoid null dereference if mst_port is unset.

2017-08-10 Thread Rodrigo Vivi
I'm not sure if this is really the case and I don't believe
this is the real fix for the bug mentioned here, but since
I don't see a reliable path when mst_port is set and when
mode_valid is requested I believe it is worth to have this
protection here.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102022
Cc: Elizabeth 
Cc: Stefan Assmann 
Cc: Dhinakaran Pandiyan 
Signed-off-by: Rodrigo Vivi 
---
 drivers/gpu/drm/i915/intel_dp_mst.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c 
b/drivers/gpu/drm/i915/intel_dp_mst.c
index 58568559711a..93fc8ab9bb31 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -370,6 +370,9 @@ intel_dp_mst_mode_valid(struct drm_connector *connector,
int bpp = 24; /* MST uses fixed bpp */
int max_rate, mode_rate, max_lanes, max_link_clock;
 
+   if (!intel_dp)
+   return MODE_ERROR;
+
max_link_clock = intel_dp_max_link_rate(intel_dp);
max_lanes = intel_dp_max_lane_count(intel_dp);
 
-- 
2.13.2

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: Avoid null dereference if mst_port is unset.

2017-08-10 Thread Chris Wilson
Quoting Rodrigo Vivi (2017-08-10 15:50:43)
> I'm not sure if this is really the case and I don't believe
> this is the real fix for the bug mentioned here, but since
> I don't see a reliable path when mst_port is set and when
> mode_valid is requested I believe it is worth to have this
> protection here.

The guard looks correct. We defend ourselves against the async
disconnect elsewhere through the post-detect callbacks, i.e. we cannot
rely on intel_connector->mst_port remaining valid for a whole detect()
cycle.

Reviewed-by: Chris Wilson 
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: Avoid null dereference if mst_port is unset.

2017-08-10 Thread Stefan Assmann
On 2017-08-10 07:50, Rodrigo Vivi wrote:
> I'm not sure if this is really the case and I don't believe
> this is the real fix for the bug mentioned here, but since
> I don't see a reliable path when mst_port is set and when
> mode_valid is requested I believe it is worth to have this
> protection here.

Hi Rodrigo,

I've applied the patch but problem seems to be somewhere else. After
switching display input the system is no longer reachable via ssh.
I ran dmesg -w over ssh and captured the output as far as possible.
Have a look:
https://paste.fedoraproject.org/paste/mgzW~jAzpaS4A3rmfkTZKw

Thanks!

  Stefan

> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102022
> Cc: Elizabeth 
> Cc: Stefan Assmann 
> Cc: Dhinakaran Pandiyan 
> Signed-off-by: Rodrigo Vivi 
> ---
>  drivers/gpu/drm/i915/intel_dp_mst.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c 
> b/drivers/gpu/drm/i915/intel_dp_mst.c
> index 58568559711a..93fc8ab9bb31 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -370,6 +370,9 @@ intel_dp_mst_mode_valid(struct drm_connector *connector,
>   int bpp = 24; /* MST uses fixed bpp */
>   int max_rate, mode_rate, max_lanes, max_link_clock;
>  
> + if (!intel_dp)
> + return MODE_ERROR;
> +
>   max_link_clock = intel_dp_max_link_rate(intel_dp);
>   max_lanes = intel_dp_max_lane_count(intel_dp);
>  
> -- 
> 2.13.2
> 
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: Avoid null dereference if mst_port is unset.

2017-08-10 Thread Pandiyan, Dhinakaran
On Thu, 2017-08-10 at 19:45 +0200, Stefan Assmann wrote:
> On 2017-08-10 07:50, Rodrigo Vivi wrote:
> > I'm not sure if this is really the case and I don't believe
> > this is the real fix for the bug mentioned here, but since
> > I don't see a reliable path when mst_port is set and when
> > mode_valid is requested I believe it is worth to have this
> > protection here.
> 
> Hi Rodrigo,
> 
> I've applied the patch but problem seems to be somewhere else. After
> switching display input the system is no longer reachable via ssh.
> I ran dmesg -w over ssh and captured the output as far as possible.
> Have a look:
> https://paste.fedoraproject.org/paste/mgzW~jAzpaS4A3rmfkTZKw
> 
> Thanks!
> 
>   Stefan
> 

Looking at the logs, it appears you have a MST monitor connected to a
MST-dock. DP-3 should have been branch device that always remains
disconnected. But the log shows
[3.812789] [drm] forcing DP-3 connector on
[3.812809] [drm:drm_connector_init [drm]] cmdline mode for connector
DP-3 0x0@60Hz

And then when there is a long pulse (when you switched modes on the
monitor), which should be marking all connectors as disconnected.

[  244.504884] [drm:intel_get_hpd_pins [i915]] hotplug event received,
stat 0x0040, dig 0x00101210, pins 0x0040

This happens -
[  244.668328] [drm:drm_helper_probe_single_connector_modes
[drm_kms_helper]] [CONNECTOR:79:DP-3] status updated from disconnected
to connected

Looks like this has something to do with the connector status being
forced.


-DK


> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102022
> > Cc: Elizabeth 
> > Cc: Stefan Assmann 
> > Cc: Dhinakaran Pandiyan 
> > Signed-off-by: Rodrigo Vivi 
> > ---
> >  drivers/gpu/drm/i915/intel_dp_mst.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c 
> > b/drivers/gpu/drm/i915/intel_dp_mst.c
> > index 58568559711a..93fc8ab9bb31 100644
> > --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> > @@ -370,6 +370,9 @@ intel_dp_mst_mode_valid(struct drm_connector *connector,
> > int bpp = 24; /* MST uses fixed bpp */
> > int max_rate, mode_rate, max_lanes, max_link_clock;
> >  
> > +   if (!intel_dp)
> > +   return MODE_ERROR;
> > +
> > max_link_clock = intel_dp_max_link_rate(intel_dp);
> > max_lanes = intel_dp_max_lane_count(intel_dp);
> >  
> > -- 
> > 2.13.2
> > 
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: Avoid null dereference if mst_port is unset.

2017-08-10 Thread Rodrigo Vivi
On Thu, Aug 10, 2017 at 9:23 AM, Chris Wilson  wrote:
> Quoting Rodrigo Vivi (2017-08-10 15:50:43)
>> I'm not sure if this is really the case and I don't believe
>> this is the real fix for the bug mentioned here, but since
>> I don't see a reliable path when mst_port is set and when
>> mode_valid is requested I believe it is worth to have this
>> protection here.
>
> The guard looks correct. We defend ourselves against the async
> disconnect elsewhere through the post-detect callbacks, i.e. we cannot
> rely on intel_connector->mst_port remaining valid for a whole detect()
> cycle.
>
> Reviewed-by: Chris Wilson 

thanks, merged to dinq.

the discussion around the actual bug should move back to 102022


> -Chris
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx