All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Anshuman Gupta <anshuman.gupta@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/debugfs: HDCP capability enc NULL check
Date: Thu, 11 Feb 2021 13:48:24 +0200	[thread overview]
Message-ID: <20210211114824.GA77505@ideak-desk.fi.intel.com> (raw)
In-Reply-To: <20210211062949.7045-1-anshuman.gupta@intel.com>

On Thu, Feb 11, 2021 at 11:59:49AM +0530, Anshuman Gupta wrote:
> DP-MST connector encoder initializes at modeset
> Adding a connector->encoder NULL check in order to
> avoid any NULL pointer dereference.
> intel_hdcp_enable() already handle this but debugfs
> can also invoke the intel_{hdcp,hdcp2_capable}.
> Handling it gracefully.
> 
> v2:
> - Use necessary lock and NULL check in
>   i915_hdcp_sink_capability_show. [Imre]
> 
> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
> ---
>  .../gpu/drm/i915/display/intel_display_debugfs.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> index d6e4a9237bda..ed5e2f65b171 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> @@ -2198,14 +2198,26 @@ DEFINE_SHOW_ATTRIBUTE(i915_panel);
>  static int i915_hdcp_sink_capability_show(struct seq_file *m, void *data)
>  {
>  	struct drm_connector *connector = m->private;
> +	struct drm_i915_private *i915 = to_i915(connector->dev);
>  	struct intel_connector *intel_connector = to_intel_connector(connector);
> +	int ret;
>  
> -	if (connector->status != connector_status_connected)
> -		return -ENODEV;
> +	ret = drm_modeset_lock_single_interruptible(&i915->drm.mode_config.connection_mutex);
> +	if (ret)
> +		return ret;
> +
> +	if (!connector->encoder || connector->status != connector_status_connected) {
> +		ret = -ENODEV;
> +		goto out;
> +	}
>  
>  	seq_printf(m, "%s:%d HDCP version: ", connector->name,
>  		   connector->base.id);
>  	intel_hdcp_info(m, intel_connector);
> +out:
> +	drm_modeset_unlock(&i915->drm.mode_config.connection_mutex);
> +	if (ret)
> +		return ret;
>  
>  	return 0;

Could be just
	return ret;

Reviewed-by: Imre Deak <imre.deak@intel.com>

>  }
> -- 
> 2.26.2
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2021-02-11 11:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29  8:00 [Intel-gfx] [PATCH] drm/i915/debugfs: HDCP capability enc NULL check Anshuman Gupta
2021-01-29 10:09 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2021-01-29 15:43 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2021-02-01 10:54 ` [Intel-gfx] [PATCH] " Nautiyal, Ankit K
2021-02-01 10:57   ` Gupta, Anshuman
2021-02-04 18:28 ` Imre Deak
2021-02-05  8:16   ` Gupta, Anshuman
2021-02-05 12:04     ` Imre Deak
2021-02-05 12:12       ` Gupta, Anshuman
2021-02-09  5:39         ` Gupta, Anshuman
2021-02-09 10:27           ` Imre Deak
2021-02-11  6:29 ` [Intel-gfx] [PATCH v2] " Anshuman Gupta
2021-02-11 11:48   ` Imre Deak [this message]
2021-02-11  7:30 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/debugfs: HDCP capability enc NULL check (rev2) Patchwork
2021-02-11 13:25 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-02-11 14:05 ` [Intel-gfx] [PATCH v2] drm/i915/debugfs: HDCP capability enc NULL check Anshuman Gupta
2021-02-11 15:27 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/debugfs: HDCP capability enc NULL check (rev3) Patchwork
2021-02-11 16:42 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-02-12  3:45   ` Anshuman Gupta
2021-02-12  6:26     ` Vudum, Lakshminarayana
2021-02-12 10:01       ` Gupta, Anshuman
2021-02-12  5:16 ` [Intel-gfx] ✓ Fi.CI.IGT: success " 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=20210211114824.GA77505@ideak-desk.fi.intel.com \
    --to=imre.deak@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=intel-gfx@lists.freedesktop.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.