Skip to content

Commit

Permalink
drm/radeon/kms: Fix NULL ptr dereference
Browse files Browse the repository at this point in the history
radeon_atombios_fini might be call while there is not valid
atombios structure allocated, thus test for a not null ptr
before trying to access this structure.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
  • Loading branch information
Jerome Glisse authored and Dave Airlie committed Dec 10, 2009
1 parent b27b637 commit 4a04a84
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/gpu/drm/radeon/radeon_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,10 @@ int radeon_atombios_init(struct radeon_device *rdev)

void radeon_atombios_fini(struct radeon_device *rdev)
{
kfree(rdev->mode_info.atom_context->scratch);
kfree(rdev->mode_info.atom_context);
if (rdev->mode_info.atom_context) {
kfree(rdev->mode_info.atom_context->scratch);
kfree(rdev->mode_info.atom_context);
}
kfree(rdev->mode_info.atom_card_info);
}

Expand Down

0 comments on commit 4a04a84

Please sign in to comment.