From patchwork Wed Apr 23 14:35:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Ichikawa X-Patchwork-Id: 4041741 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D7515BFF02 for ; Wed, 23 Apr 2014 14:36:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 13E0F201C0 for ; Wed, 23 Apr 2014 14:36:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2D5A620160 for ; Wed, 23 Apr 2014 14:36:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752882AbaDWOgA (ORCPT ); Wed, 23 Apr 2014 10:36:00 -0400 Received: from mail-pb0-f52.google.com ([209.85.160.52]:50091 "EHLO mail-pb0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752332AbaDWOf5 (ORCPT ); Wed, 23 Apr 2014 10:35:57 -0400 Received: by mail-pb0-f52.google.com with SMTP id rq2so842367pbb.39 for ; Wed, 23 Apr 2014 07:35:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=zyk06XJsQ9bOwDXqmqT36glu8nJnfjJR+dNcwe0zQHU=; b=wKNdfdVXTnF8+jYC8+vNFBIHzti2ekh9YRK6BrCpEC0aLpwqUNkaWCmG6BgrI2Wjrv XVEW4JeNfZf2q4wAtrdit1XZW/kA3gt9qlEfSxnWtBQKvgVg6AGbxLMm1zDqqj1918o0 X/kSeUczmyMHha++4A77zDGcpW0Syo66TWKSG10kdqj0yN+OWnMov+X2SC6gu61ZFT+9 PnQSKptN96cYOgXaJ98fGflx5V2KPlAW8jx7LxxJhLGfFmV+2DToPfJu3C8+ohIzXKj9 9HIUwlWqqiYrKtXvRESidhJOFiTeYBkN1ExzFpPSC4yKgWvBcaHzUoD0tjkTmvmJxRub kTvw== X-Received: by 10.68.138.227 with SMTP id qt3mr56351989pbb.6.1398263757009; Wed, 23 Apr 2014 07:35:57 -0700 (PDT) Received: from localhost.localdomain (FL1-119-242-45-61.tky.mesh.ad.jp. [119.242.45.61]) by mx.google.com with ESMTPSA id ja8sm2948577pbd.3.2014.04.23.07.35.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Apr 2014 07:35:56 -0700 (PDT) From: Masami Ichikawa To: masami256@gmail.com, plagnioj@jcrosoft.com, tomi.valkeinen@ti.com, udknight@gmail.com, gregkh@linuxfoundation.org, keithp@keithp.com, mika.kuoppala@linux.intel.com, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org Subject: [PATCH] fbcon: Fix memory leak in con2fb_release_oldinfo() Date: Wed, 23 Apr 2014 23:35:22 +0900 Message-Id: <1398263722-10436-1-git-send-email-masami256@gmail.com> X-Mailer: git-send-email 1.9.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=unavailable 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 0xffff8800dab6d8d8 (size 96): comm "swapper/0", pid 1, jiffies 4294877598 (age 38.483s) hex dump (first 32 bytes): 00 00 00 00 00 01 00 00 08 00 00 00 10 00 00 00 ................ 07 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ................ backtrace: [] kmemleak_alloc+0x4e/0xb0 [] __kmalloc+0x280/0x320 [] soft_cursor+0x231/0x290 [] bit_cursor+0x613/0x650 [] fbcon_cursor+0x13b/0x1c0 [] hide_cursor+0x28/0xa0 [] redraw_screen+0x168/0x240 [] fbcon_prepare_logo+0x381/0x420 [] fbcon_init+0x34e/0x590 [] visual_init+0xb8/0x120 [] do_bind_con_driver+0x163/0x380 [] do_take_over_console+0x114/0x1c0 [] do_fbcon_takeover+0x63/0xd0 [] fbcon_event_notify+0x68d/0x7e0 [] notifier_call_chain+0x4c/0x70 [] __blocking_notifier_call_chain+0x4d/0x70 This memory leak cause is, fbcon_ops's cursor_src is allocated in soft_cursor() but not released in con2fb_release_oldinfo(). so, cursor_src is needed to be released when oldinfo is going to be released. 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 f447734..57b1d44 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c @@ -748,6 +748,7 @@ static int con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo, fbcon_del_cursor_timer(oldinfo); kfree(ops->cursor_state.mask); kfree(ops->cursor_data); + kfree(ops->cursor_src); kfree(ops->fontbuffer); kfree(oldinfo->fbcon_par); oldinfo->fbcon_par = NULL;