Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756343Ab3I3KWT (ORCPT ); Mon, 30 Sep 2013 06:22:19 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:43693 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755654Ab3I3KNF (ORCPT ); Mon, 30 Sep 2013 06:13:05 -0400 From: Luis Henriques To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, kernel-team@lists.ubuntu.com Cc: Sergey Senozhatsky , Alex Deucher , Luis Henriques Subject: [PATCH 071/104] radeon kms: fix uninitialised hotplug work usage in r100_irq_process() Date: Mon, 30 Sep 2013 11:10:48 +0100 Message-Id: <1380535881-9239-72-git-send-email-luis.henriques@canonical.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1380535881-9239-1-git-send-email-luis.henriques@canonical.com> References: <1380535881-9239-1-git-send-email-luis.henriques@canonical.com> X-Extended-Stable: 3.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4380 Lines: 112 3.5.7.22 -stable review patch. If anyone has any objections, please let me know. ------------------ From: Sergey Senozhatsky commit 27c505ca84e164ec66ad55dcf3f5befaac83f10a upstream. Commit a01c34f72e7cd2624570818f579b5ab464f93de2 (radeon kms: do not flush uninitialized hotplug work) moved work initialisation phase to the last step of radeon_irq_kms_init(). Meelis Roos reported that this causes problems on his machine because drm_irq_install() uses hotplug work on r100. hotplug work flushed in radeon_irq_kms_fini(), with two possible cases: -- radeon_irq_kms_fini() call after successful radeon_irq_kms_init() -- radeon_irq_kms_fini() call after unsuccessful (or not called at all) radeon_irq_kms_init() The latter one causes flush work on uninitialised hotplug work. Move work initialisation before drm_irq_install(), but keep existing agreement to flush hotplug work in radeon_irq_kms_fini() only for `irq.installed' (successful radeon_irq_kms_init()) case. WARNING: CPU: 0 PID: 243 at kernel/workqueue.c:1378 __queue_work+0x132/0x16d() Call Trace: [] ? dump_stack+0xa/0x13 [] ? warn_slowpath_common+0x75/0x8a [] ? __queue_work+0x132/0x16d [] ? __queue_work+0x132/0x16d [] ? warn_slowpath_null+0x1b/0x1f [] ? __queue_work+0x132/0x16d [] ? queue_work_on+0x30/0x40 [] ? r100_irq_process+0x16d/0x1e6 [radeon] [] ? radeon_driver_irq_preinstall_kms+0xc2/0xc5 [radeon] [] ? drm_irq_install+0xb2/0x1ac [drm] [] ? drm_vblank_init+0x196/0x1d2 [drm] [] ? radeon_irq_kms_init+0x33/0xc6 [radeon] [] ? r100_startup+0x1a3/0x1d6 [radeon] [] ? radeon_ttm_init+0x26e/0x287 [radeon] [] ? r100_init+0x2b3/0x309 [radeon] [] ? vga_client_register+0x39/0x40 [] ? radeon_device_init+0x54b/0x61b [radeon] [] ? cail_mc_write+0x13/0x13 [radeon] [] ? radeon_driver_load_kms+0x82/0xda [radeon] [] ? drm_get_pci_dev+0x136/0x22d [drm] [] ? radeon_pci_probe+0x6c/0x86 [radeon] [] ? pci_device_probe+0x4c/0x83 [] ? driver_probe_device+0x80/0x184 [] ? pci_match_id+0x18/0x36 [] ? __driver_attach+0x44/0x5f [] ? bus_for_each_dev+0x50/0x5a [] ? driver_attach+0x14/0x16 [] ? __device_attach+0x28/0x28 [] ? bus_add_driver+0xd6/0x1bf [] ? driver_register+0x78/0xcf [] ? 0xf8ba7fff [] ? do_one_initcall+0x8b/0x121 [] ? change_page_attr_clear+0x2e/0x33 [] ? 0xf8ba7fff [] ? set_memory_ro+0x1c/0x20 [] ? set_page_attributes+0x11/0x12 [] ? load_module+0x12fa/0x17e8 [] ? map_vm_area+0x22/0x31 [] ? SyS_init_module+0x67/0x7d [] ? sysenter_do_call+0x12/0x26 Reported-by: Meelis Roos Tested-by: Meelis Roos Signed-off-by: Sergey Senozhatsky Signed-off-by: Alex Deucher [ luis: backported to 3.5: - dropped initialisation of reset_work handler ] Signed-off-by: Luis Henriques --- drivers/gpu/drm/radeon/radeon_irq_kms.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 30003b6..6169e1b 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c @@ -198,16 +198,18 @@ int radeon_irq_kms_init(struct radeon_device *rdev) dev_info(rdev->dev, "radeon: using MSI.\n"); } } + + INIT_WORK(&rdev->hotplug_work, radeon_hotplug_work_func); + INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi); + rdev->irq.installed = true; r = drm_irq_install(rdev->ddev); if (r) { rdev->irq.installed = false; + flush_work(&rdev->hotplug_work); return r; } - INIT_WORK(&rdev->hotplug_work, radeon_hotplug_work_func); - INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi); - DRM_INFO("radeon: irq initialized.\n"); return 0; } -- 1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/