Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Gupta, Anshuman" <anshuman.gupta@intel.com>
To: "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"Nikula,  Jani" <jani.nikula@intel.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/debugfs: HDCP capability enc NULL check
Date: Mon, 1 Feb 2021 10:57:46 +0000	[thread overview]
Message-ID: <0b39733bfb214baea966b8baeb789250@intel.com> (raw)
In-Reply-To: <9dffbc85-a52d-e1e4-60f9-5d3f92807dfa@intel.com>



> -----Original Message-----
> From: Nautiyal, Ankit K <ankit.k.nautiyal@intel.com>
> Sent: Monday, February 1, 2021 4:25 PM
> To: Gupta, Anshuman <anshuman.gupta@intel.com>; intel-
> gfx@lists.freedesktop.org
> Subject: Re: [Intel-gfx] [PATCH] drm/i915/debugfs: HDCP capability enc NULL
> check
> 
> 
> On 1/29/2021 1:30 PM, 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.
> >
> > Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
> > ---
> >   drivers/gpu/drm/i915/display/intel_hdcp.c | 14 ++++++++++++--
> >   1 file changed, 12 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c
> > b/drivers/gpu/drm/i915/display/intel_hdcp.c
> > index ae1371c36a32..58af323d189a 100644
> > --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> > +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> > @@ -135,11 +135,16 @@ int intel_hdcp_read_valid_bksv(struct
> intel_digital_port *dig_port,
> >   /* Is HDCP1.4 capable on Platform and Sink */
> >   bool intel_hdcp_capable(struct intel_connector *connector)
> >   {
> > -	struct intel_digital_port *dig_port =
> intel_attached_dig_port(connector);
> > +	struct intel_digital_port *dig_port;
> >   	const struct intel_hdcp_shim *shim = connector->hdcp.shim;
> >   	bool capable = false;
> >   	u8 bksv[5];
> >
> > +	if (!connector->encoder)
> > +		return -ENODEV;
> > +
> 
> For connector->encoder check, I feel the correct place should be in
> function:
> enc_to_dig_port(), where we should return if encoder is NULL in display_types.h
@Jani could you please provide your Ack, if enc_to_dig_port() is the correct place to do connector->encoder NULL check.
Br,
Anshuman Gupta.
> Currently we assume encoder is not NULL and try to check encoder->type, which
> might break in case of MST.
> With that change, we can simply check NULL check for 'dig_port', as
> intel_attached_dig_port(connector) might still return NULL.
> 
> Regards,
> Ankit
> 
> > +	dig_port = intel_attached_dig_port(connector);
> > +
> >   	if (!shim)
> >   		return capable;
> >
> > @@ -156,11 +161,16 @@ bool intel_hdcp_capable(struct intel_connector
> *connector)
> >   /* Is HDCP2.2 capable on Platform and Sink */
> >   bool intel_hdcp2_capable(struct intel_connector *connector)
> >   {
> > -	struct intel_digital_port *dig_port =
> intel_attached_dig_port(connector);
> > +	struct intel_digital_port *dig_port;
> >   	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
> >   	struct intel_hdcp *hdcp = &connector->hdcp;
> >   	bool capable = false;
> >
> > +	if (!connector->encoder)
> > +		return -ENODEV;
> > +
> > +	dig_port = intel_attached_dig_port(connector);
> > +
> >   	/* I915 support for HDCP2.2 */
> >   	if (!hdcp->hdcp2_supported)
> >   		return false;
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2021-02-01 10:57 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 [this message]
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
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=0b39733bfb214baea966b8baeb789250@intel.com \
    --to=anshuman.gupta@intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox