Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759615AbYAKN2r (ORCPT ); Fri, 11 Jan 2008 08:28:47 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1761095AbYAKN22 (ORCPT ); Fri, 11 Jan 2008 08:28:28 -0500 Received: from vervifontaine.sonytel.be ([80.88.33.193]:44010 "EHLO vervifontaine.sonycom.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1761049AbYAKN20 (ORCPT ); Fri, 11 Jan 2008 08:28:26 -0500 Date: Fri, 11 Jan 2008 14:27:10 +0100 (CET) From: Geert Uytterhoeven To: Linus Torvalds , Andrew Morton cc: Jeremy Kerr , Cell Broadband Engine OSS Development , Linux/PPC Development , Linux Frame Buffer Device Development Subject: [PATCH 1/2] ps3fb: prevent use after free of fb_info In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-584349381-891518858-1200058030=:12536" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2272 Lines: 71 ---584349381-891518858-1200058030=:12536 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: 8BIT From: Jeremy Kerr In ps3fb_shutdown, freeing the framebuffer will cause fb_info (in dev->core.driver_data) to be free()ed, which we potentially access from the ps3fbd kthread. This change frees the framebuffer after stopping the ps3fbd kthread. Signed-off-by: Jeremy Kerr Signed-off-by: Geert Uytterhoeven --- drivers/video/ps3fb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c @@ -1234,12 +1234,6 @@ static int ps3fb_shutdown(struct ps3_sys ps3fb_flip_ctl(0, &ps3fb); /* flip off */ ps3fb.dinfo->irq.mask = 0; - if (info) { - unregister_framebuffer(info); - fb_dealloc_cmap(&info->cmap); - framebuffer_release(info); - } - ps3av_register_flip_ctl(NULL, NULL); if (ps3fb.task) { struct task_struct *task = ps3fb.task; @@ -1250,6 +1244,12 @@ static int ps3fb_shutdown(struct ps3_sys free_irq(ps3fb.irq_no, &dev->core); ps3_irq_plug_destroy(ps3fb.irq_no); } + if (info) { + unregister_framebuffer(info); + fb_dealloc_cmap(&info->cmap); + framebuffer_release(info); + info = dev->core.driver_data = NULL; + } iounmap((u8 __iomem *)ps3fb.dinfo); status = lv1_gpu_context_free(ps3fb.context_handle); With kind regards, Geert Uytterhoeven Software Architect Sony Network and Software Technology Center Europe The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium Phone: +32 (0)2 700 8453 Fax: +32 (0)2 700 8622 E-mail: Geert.Uytterhoeven@sonycom.com Internet: http://www.sony-europe.com/ Sony Network and Software Technology Center Europe A division of Sony Service Centre (Europe) N.V. Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium VAT BE 0413.825.160 · RPR Brussels Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619 ---584349381-891518858-1200058030=:12536-- -- 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/