From: Jerome Glisse Date: Wed, 9 Dec 2009 16:39:16 +0000 (+0100) Subject: drm/radeon/kms: Fix NULL ptr dereference X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=4a04a844ba0c09b5641bf2ebd9f9517aa76e52fb;p=openwrt%2Fstaging%2Fblogic.git drm/radeon/kms: Fix NULL ptr dereference 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 Signed-off-by: Dave Airlie --- diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 7e55647f118e..410859ee112f 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -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); }