From patchwork Wed Dec 25 14:47:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Ichikawa X-Patchwork-Id: 3405441 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 260219F314 for ; Wed, 25 Dec 2013 14:48:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4E01720136 for ; Wed, 25 Dec 2013 14:48:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 50C3E20127 for ; Wed, 25 Dec 2013 14:48:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752048Ab3LYOs4 (ORCPT ); Wed, 25 Dec 2013 09:48:56 -0500 Received: from mail-pd0-f174.google.com ([209.85.192.174]:55078 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752035Ab3LYOsz (ORCPT ); Wed, 25 Dec 2013 09:48:55 -0500 Received: by mail-pd0-f174.google.com with SMTP id x10so7192463pdj.19 for ; Wed, 25 Dec 2013 06:48:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=CiWg2ckkjFi9Q1kHLPN3YvXotOYuuE99uaMcsTcU3pk=; b=iRcic8zubeoAk/ZnXgbWN+H/Jmx9o0n04ZdmmcSsnoWbdw2vLYedJ7ZA1cpjOEPd8S kHMvseD/783qcFtzg1XT4KvY5EaYutCnx6UsviP8YFcH2cgGlTQ06i/KDEjNIzTMmtoc eCVd4E0cWwXIuyiS1Kv1ieGvZFIv8kU2xAgFLrTredFa1GdpUdjYoDq5ugUarv40FrVX XfBWlWDnV+n3BwtVyrJobt1B9L7nMT0pv4ggE+Yx+7MIOWfNX4Y+v/khlPuSJ/XXWVDN 3Cki8S+wqVGQ5K99nMl6Yb7OxS3dG6kOzJ1E7E5VZVLWAsRqK0jJvdWeDoT7ASKSq0kW N+Lw== X-Received: by 10.68.230.228 with SMTP id tb4mr38953403pbc.108.1387982935093; Wed, 25 Dec 2013 06:48:55 -0800 (PST) Received: from localhost.localdomain (FLH1Acp245.tky.mesh.ad.jp. [221.170.67.245]) by mx.google.com with ESMTPSA id nl7sm48885469pbc.6.2013.12.25.06.48.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Dec 2013 06:48:54 -0800 (PST) From: Masami Ichikawa To: plagnioj@jcrosoft.com, tomi.valkeinen@ti.com, linux-fbdev@vger.kernel.org Cc: airlied@redhat.com, udknight@gmail.com, gregkh@linuxfoundation.org, akpm@linux-foundation.org, tiwai@suse.de, linux-kernel@vger.kernel.org, masami256@gmail.com Subject: [PATCH] fbcon: Fix memory leak in fbcon_exit(). Date: Wed, 25 Dec 2013 23:47:37 +0900 Message-Id: <1387982857-14500-1-git-send-email-masami256@gmail.com> X-Mailer: git-send-email 1.8.5.2 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP kmemleak reported a memory leak as below. unreferenced object 0xffff880036ca84c0 (size 16): comm "swapper/0", pid 1, jiffies 4294877407 (age 4434.633s) hex dump (first 16 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff ................ backtrace: [] kmemleak_alloc+0x4e/0xb0 [] __kmalloc+0x1fc/0x290 [] bit_cursor+0x24e/0x6c0 [] fbcon_cursor+0x154/0x1d0 [] hide_cursor+0x28/0xa0 [] update_region+0x6f/0x90 [] fbcon_switch+0x518/0x550 [] redraw_screen+0x189/0x240 [] do_bind_con_driver+0x360/0x380 [] do_take_over_console+0x114/0x1c0 [] do_fbcon_takeover+0x63/0xd0 [] fbcon_event_notify+0x605/0x720 [] notifier_call_chain+0x4c/0x70 [] __blocking_notifier_call_chain+0x4d/0x70 [] blocking_notifier_call_chain+0x16/0x20 [] fb_notifier_call_chain+0x1b/0x20 In this case ops->cursor_state.mask is allocated in bit_cursor() but not freed in fbcon_exit(). So, fbcon_exit() needs to free buffer in its process. In the case, fbcon_exit() was called from fbcon_deinit() when driver called remove_conflicting_framebuffers(). Signed-off-by: Masami Ichikawa --- drivers/video/console/fbcon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index cd8a802..4f02375 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c @@ -3561,6 +3561,7 @@ static void fbcon_exit(void) fbcon_del_cursor_timer(info); kfree(ops->cursor_src); + kfree(ops->cursor_state.mask); kfree(info->fbcon_par); info->fbcon_par = NULL; }