Re: [PATCH 1/4] drm/i915: Don't leak edid in intel_crt_detect_ddc()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 20 Jan 2017, Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@xxxxxxxxx> wrote:
> In the path where intel_crt_detect_ddc() detects a CRT, if would return
> true without freeing the edid.
>
> Found by coverity.
>
> Fixes: a2bd1f541f19 ("drm/i915: check whether we actually received an
> edid in detect_ddc")
> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> Cc: Daniel Vetter <daniel.vetter@xxxxxxxx>
> Cc: Daniel Vetter <daniel.vetter@xxxxxxxxx>
> Cc: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>
> Cc: intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> Cc: <stable@xxxxxxxxxxxxxxx> # v3.6+
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@xxxxxxxxx>

Reviewed-by: Jani Nikula <jani.nikula@xxxxxxxxx>

> ---
>  drivers/gpu/drm/i915/intel_crt.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index 385e29a..2bf5aca 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -499,6 +499,7 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector)
>  	struct drm_i915_private *dev_priv = to_i915(crt->base.base.dev);
>  	struct edid *edid;
>  	struct i2c_adapter *i2c;
> +	bool ret = false;
>  
>  	BUG_ON(crt->base.type != INTEL_OUTPUT_ANALOG);
>  
> @@ -515,17 +516,17 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector)
>  		 */
>  		if (!is_digital) {
>  			DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n");
> -			return true;
> +			ret = true;
> +		} else {
> +			DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [EDID reports a digital panel]\n");
>  		}
> -
> -		DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [EDID reports a digital panel]\n");
>  	} else {
>  		DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [no valid EDID found]\n");
>  	}
>  
>  	kfree(edid);
>  
> -	return false;
> +	return ret;
>  }
>  
>  static enum drm_connector_status

-- 
Jani Nikula, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]