Received: by 10.223.185.116 with SMTP id b49csp3945659wrg; Tue, 13 Feb 2018 10:09:30 -0800 (PST) X-Google-Smtp-Source: AH8x2255d3Gf/lcYGOjTERVHYI07+a+UghP9kvDSeIRWfdm1vspBmpCQ8em8kB0jUM2o2rU6r9yJ X-Received: by 2002:a17:902:5417:: with SMTP id d23-v6mr1876329pli.330.1518545370898; Tue, 13 Feb 2018 10:09:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518545370; cv=none; d=google.com; s=arc-20160816; b=mJ+mjgiVO1EugkusaGsdRZVYYer/pWzIyCX9eTHvxdkCHO1Vog/XTdqGbuCCX8P724 5A1IoOuzH54IuKr3aOE1j7/hamBLWWcI2+HBdjmwj/bYQUNXBIUL6CIbc03U192OWozn sHGSQeHR59NrcWHIXjrD5g8iDHRpxFj4s6d1/WWwEGV76YDI0U2FOPuSJaq+io2S1HFo 5Lb+X+nSuB7siL52uMr0/JN89GeSg8B/WDxt6J4OVYQqhn8sFMkFz7m4FId+bXwo0Cdo 8CKvqYdmMSqeiwA551SE3SBlHmFvn20FSz6V+SR+ZwnvDHbncXXcgoLx3TwB+dblb7No n6HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=EkmZo0aNMdfJ6M3CnBUgasm6wzpeluUkqJTKjA8u2rw=; b=ctd+JgBPLE0SAJ5gnjSy0Htr3kLqp7F28qT26317lfEKw8P2PuC4LQRFvPsyiY9Z8o kyD64p4xlNhvzJWAoPSEZ6NjykWUtqNGZaLaCONybYcVEa87JaBJwulf1zomIo9DpTks zELG90oeXJ7BIwkncLTS/viSC/ZJGJ/3EZx6apCjXcAAzKWiFommw1Zf3ut/mKkSF8/1 /TUlLpXFq+MY+UNCxq6rQCtlBS1vmuU+tdVBS79RS7thKC32TRV2kRwJmrxcmsKMXInC gGPvf/75e4izCN3xvFiJ6YAqlZplFhQeMzYD2m6EIUuiljArKW+o6gjSzCAY3gxM2pL7 sg5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=EbU7CQJF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5si117682pgc.233.2018.02.13.10.09.08; Tue, 13 Feb 2018 10:09:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=EbU7CQJF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965423AbeBMSIY (ORCPT + 99 others); Tue, 13 Feb 2018 13:08:24 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35472 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965158AbeBMSIW (ORCPT ); Tue, 13 Feb 2018 13:08:22 -0500 Received: by mail-wm0-f68.google.com with SMTP id r78so17658121wme.0; Tue, 13 Feb 2018 10:08:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=EkmZo0aNMdfJ6M3CnBUgasm6wzpeluUkqJTKjA8u2rw=; b=EbU7CQJFM4o3sujQP1Z1ql7Qe81y+bdJ2F4WHHr2va4NO9b1QTN+O+zfWTqeP1s480 ITAxxjjT1VzSUii6HTFnNTc4zbj5A801NrgTUTdN51yfbUmHp0AdSncG64v6du2fmPRG t8tI5wQy7nKfShhlX/FHl1SZf0wEC7X1kyx6r2tE3tvnxXeHD+vJCo53YvdV2KbKRkpr vp+lVJuvYBEjrfXxds0QWnbC5uwKp5RoK+kfzY27wCxzIWW0g0nOCg7qPaGP/SyiqevM XIY00UIboOpRVuw/eq/enibVNRVjCzJM4N4BamM+mZdea3G6CK75Hczx8KrThGR9K2/s TQtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=EkmZo0aNMdfJ6M3CnBUgasm6wzpeluUkqJTKjA8u2rw=; b=ca8qIBynNRqD29d2WLtiCRGjOzSk9l6AO9n9H/oyyvobtAoT4N0m8xpu36bGGXasEy EISWE3rDIPsgXzrTyXx1tm6fYrhTPUr9tZjmhb9PJqMGFu75TIyxivWR58tBZjwd2mE7 xPVTHh4A7aIUQe23ceLB43s/Smtc4660m1bfS1ZoPzM3cZ87Bvxky1+u4flr6VcO18qF 1rD3h8H/yX2Z5FSHoI2rdjJHa+Vt5I0mWUs+nzo0UijLeMFV1v/BxoA/EyIuzM8YyjGy qjQUiK7OAgE0HpQT7v15VVgTziJwwLeJja0gCpbz2HXdAj1b44t7ft/IT9yU0KGUdJGd dSSw== X-Gm-Message-State: APf1xPAGM4KbZiuAAfz80lZVM60zDki1d3CoVxh6lisCGXiAd0vupvOb 49A4rrvaZX3RGy9cgMAabak= X-Received: by 10.28.17.17 with SMTP id 17mr2173440wmr.123.1518545301062; Tue, 13 Feb 2018 10:08:21 -0800 (PST) Received: from macbookpro.malat.net (bru31-1-78-225-226-121.fbx.proxad.net. [78.225.226.121]) by smtp.gmail.com with ESMTPSA id t196sm1758307wme.47.2018.02.13.10.08.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Feb 2018 10:08:20 -0800 (PST) Received: by macbookpro.malat.net (Postfix, from userid 1000) id 5C62C10C04A4; Tue, 13 Feb 2018 19:08:19 +0100 (CET) From: Mathieu Malaterre To: Bartlomiej Zolnierkiewicz Cc: Mathieu Malaterre , Rob Herring , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] video: offb: Deallocate the color map Date: Tue, 13 Feb 2018 19:07:45 +0100 Message-Id: <20180213180747.12666-1-malat@debian.org> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The function offb_destroy did not deallocate the color map leaving some memory around after destruction. Call the color map deallocate function to remove the memory leak. Handle another case where color map should have been deallocated during an error code path. Fix memory leaks reported by kmemleak: # dmesg ... [ 1884.719941] kmemleak: 3 new suspected memory leaks (see /sys/kernel/debug/kmemleak) # cat /sys/kernel/debug/kmemleak unreferenced object 0xde3d9000 (size 512): comm "swapper", pid 1, jiffies 4294892827 (age 1906.784s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 aa aa aa aa aa aa aa aa ................ 55 55 55 55 55 55 55 55 ff ff ff ff ff ff ff ff UUUUUUUU........ backtrace: [] fb_alloc_cmap_gfp+0x54/0x15c [] offb_init_nodriver+0x8e8/0xa3c [] offb_init+0xd0/0x164 [<322f82a3>] do_one_initcall+0x4c/0x178 [] kernel_init_freeable+0x138/0x1cc [<2a17fa0e>] kernel_init+0x24/0x118 [<4079749a>] ret_from_kernel_thread+0x5c/0x64 unreferenced object 0xde3d9200 (size 512): comm "swapper", pid 1, jiffies 4294892827 (age 1906.784s) hex dump (first 32 bytes): 00 00 00 00 aa aa aa aa 00 00 00 00 55 55 aa aa ............UU.. 55 55 55 55 ff ff ff ff 55 55 55 55 ff ff ff ff UUUU....UUUU.... backtrace: [<4bf3594d>] fb_alloc_cmap_gfp+0x6c/0x15c [] offb_init_nodriver+0x8e8/0xa3c [] offb_init+0xd0/0x164 [<322f82a3>] do_one_initcall+0x4c/0x178 [] kernel_init_freeable+0x138/0x1cc [<2a17fa0e>] kernel_init+0x24/0x118 [<4079749a>] ret_from_kernel_thread+0x5c/0x64 unreferenced object 0xde3d9600 (size 512): comm "swapper", pid 1, jiffies 4294892827 (age 1906.784s) hex dump (first 32 bytes): 00 00 aa aa 00 00 aa aa 00 00 aa aa 00 00 aa aa ................ 55 55 ff ff 55 55 ff ff 55 55 ff ff 55 55 ff ff UU..UU..UU..UU.. backtrace: [<23a3ea03>] fb_alloc_cmap_gfp+0x84/0x15c [] offb_init_nodriver+0x8e8/0xa3c [] offb_init+0xd0/0x164 [<322f82a3>] do_one_initcall+0x4c/0x178 [] kernel_init_freeable+0x138/0x1cc [<2a17fa0e>] kernel_init+0x24/0x118 [<4079749a>] ret_from_kernel_thread+0x5c/0x64 Signed-off-by: Mathieu Malaterre --- drivers/video/fbdev/offb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/offb.c b/drivers/video/fbdev/offb.c index 6f65d132eba1..30786445de04 100644 --- a/drivers/video/fbdev/offb.c +++ b/drivers/video/fbdev/offb.c @@ -282,6 +282,7 @@ static void offb_destroy(struct fb_info *info) if (info->screen_base) iounmap(info->screen_base); release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size); + fb_dealloc_cmap(&info->cmap); framebuffer_release(info); } @@ -520,6 +521,7 @@ static void __init offb_init_fb(const char *name, return; out_err: + fb_dealloc_cmap(&info->cmap); iounmap(info->screen_base); out_aper: iounmap(par->cmap_adr); -- 2.11.0