[Intel-gfx] [PATCH 2/2] drm/i915/sdvo: kfree the intel_sdvo_connector, not drm_connector, on destroy
Ville Syrjälä
ville.syrjala at linux.intel.com
Mon Nov 12 17:48:15 CET 2012
On Mon, Nov 12, 2012 at 06:31:36PM +0200, Jani Nikula wrote:
> Since the base fields in both struct intel_connector and struct
> intel_sdvo_connector are at the beginning of the enclosing struct, the
> pointers are essentially the same, but there is no requirement or guarantee
> that this is always the case. Kfree the enclosing intel_sdvo_connector
> pointer that was originally allocated, not the enclosed drm_connector, in
> case someone ever rearranges the structs.
BTW in several places the reworked (maybe also the old?) modeset code
depends on the base drm struct being in the beginning of the intel
specific struct.
Here's one of the culprits from intel_modeset_commit_output_state():
connector->base.encoder = &connector->new_encoder->base;
If connector->new_encoder is NULL this will generate a bogus address
unless new_encoder.base is at offset 0.
We should probably have some compile time asserts to prevent anyone from
making a mess by accident.
--
Ville Syrjälä
Intel OTC
More information about the Intel-gfx
mailing list