diff options
author | Dave Airlie <airlied@redhat.com> | 2016-06-03 00:08:20 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-06-03 00:08:20 -0400 |
commit | 35962eaef44166fd8d4fff7cb4e9c64a2da536ee (patch) | |
tree | cd158263f67e699b6c3bf6d4f99bfc5a2e467c64 | |
parent | 6572c8c637278d64dfd355e84a6dcb64b9d6cf28 (diff) | |
parent | 58a2ab3af722550b2e4e8155eb08660e16c20ee6 (diff) |
Merge tag 'drm-atmel-hlcdc-fixes/for-4.7-rc2' of github.com:bbrezillon/linux-at91 into drm-fixes
Two trivial bugfixes for the atmel-hlcdc driver.
The first one is making use of __drm_atomic_helper_crtc_destroy_state()
instead of duplicating its logic in atmel_hlcdc_crtc_reset() and
risking memory leaks if other objects are added to the common CRTC
state.
The second one is fixing a possible NULL pointer dereference.
* tag 'drm-atmel-hlcdc-fixes/for-4.7-rc2' of github.com:bbrezillon/linux-at91:
drm: atmel-hlcdc: fix a NULL check
drm: atmel-hlcdc: fix atmel_hlcdc_crtc_reset() implementation
-rw-r--r-- | drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c index cf23a755f777..bd12231ab0cd 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | |||
@@ -391,12 +391,11 @@ void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) | |||
391 | { | 391 | { |
392 | struct atmel_hlcdc_crtc_state *state; | 392 | struct atmel_hlcdc_crtc_state *state; |
393 | 393 | ||
394 | if (crtc->state && crtc->state->mode_blob) | ||
395 | drm_property_unreference_blob(crtc->state->mode_blob); | ||
396 | |||
397 | if (crtc->state) { | 394 | if (crtc->state) { |
395 | __drm_atomic_helper_crtc_destroy_state(crtc->state); | ||
398 | state = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state); | 396 | state = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state); |
399 | kfree(state); | 397 | kfree(state); |
398 | crtc->state = NULL; | ||
400 | } | 399 | } |
401 | 400 | ||
402 | state = kzalloc(sizeof(*state), GFP_KERNEL); | 401 | state = kzalloc(sizeof(*state), GFP_KERNEL); |
@@ -415,8 +414,9 @@ atmel_hlcdc_crtc_duplicate_state(struct drm_crtc *crtc) | |||
415 | return NULL; | 414 | return NULL; |
416 | 415 | ||
417 | state = kmalloc(sizeof(*state), GFP_KERNEL); | 416 | state = kmalloc(sizeof(*state), GFP_KERNEL); |
418 | if (state) | 417 | if (!state) |
419 | __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base); | 418 | return NULL; |
419 | __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base); | ||
420 | 420 | ||
421 | cur = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state); | 421 | cur = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state); |
422 | state->output_mode = cur->output_mode; | 422 | state->output_mode = cur->output_mode; |