From patchwork Mon Sep 17 05:09:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 11456 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5DCBE23E2F for ; Mon, 17 Sep 2012 05:15:35 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id B0DB13D02E8D for ; Mon, 17 Sep 2012 05:15:34 +0000 (UTC) Received: by iafj25 with SMTP id j25so4869533iaf.11 for ; Sun, 16 Sep 2012 22:15:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=4ibz7xm6kKTUwEJQ+AoKpGqfxAs55YBMbfe+nfGDuMs=; b=N5S4sv2mfRUwKjhHpREkjZXUXLeme9q0MEIw3uDZv7A1r9duIOyAPA7BDw6kpdEP76 dIIAWE6f2Gj52aswzV22Xgf0aFMDIvfCYzjNFrk/Tl8v2TKkKaAfTTKJ0VpDx8UVPIsg DRalWyGNK2+BjWpAAew4pl2VedX/4snL2mc/NPdp74VDZhJIjV1m2rPh0OJwqsm8q4QO gJ8OQK3ZEtbvwMFcM9ac1DRG/hehCcEwUtWD9nUM5llZaplECLjrNQiuZqQOSpDKSkrX EB671UcHJPdM/HosKx4NuezCgL8HxiiITd1mYJJuZ+x3AnYibAOE9W2oBuA/Mf5lOKVI Crgw== Received: by 10.50.217.227 with SMTP id pb3mr5627367igc.28.1347858934122; Sun, 16 Sep 2012 22:15:34 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp296045igc; Sun, 16 Sep 2012 22:15:33 -0700 (PDT) Received: by 10.68.232.106 with SMTP id tn10mr20314157pbc.26.1347858932657; Sun, 16 Sep 2012 22:15:32 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id sb7si13992967pbc.331.2012.09.16.22.15.32 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 16 Sep 2012 22:15:32 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by pbcmd12 with SMTP id md12so9712951pbc.37 for ; Sun, 16 Sep 2012 22:15:32 -0700 (PDT) Received: by 10.68.193.194 with SMTP id hq2mr20504214pbc.93.1347858932132; Sun, 16 Sep 2012 22:15:32 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id gf8sm6343910pbc.52.2012.09.16.22.15.27 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 16 Sep 2012 22:15:31 -0700 (PDT) From: Sachin Kamat To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, sachin.kamat@linaro.org, patches@linaro.org, Arnd Bergmann , Marek Szyprowski Subject: [PATCH] ARM: dma-mapping: Fix potential memory leak in atomic_pool_init() Date: Mon, 17 Sep 2012 10:39:43 +0530 Message-Id: <1347858583-13338-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQkcumuGmNZxyFifYPreITb+Ogg4dnP2hw5jJ2aZwhkbXDYsMfMlOHrAJXcto/hQwvASImZ4 When either of __alloc_from_contiguous or __alloc_remap_buffer fails to provide a valid pointer, allocated memory is freed up and an error is returned. 'pages' was however not freed before returning error. Cc: Arnd Bergmann Cc: Marek Szyprowski Signed-off-by: Sachin Kamat --- arch/arm/mm/dma-mapping.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 546a3e8..477a2d2 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -367,6 +367,8 @@ static int __init atomic_pool_init(void) (unsigned)pool->size / 1024); return 0; } + + kfree(pages); no_pages: kfree(bitmap); no_bitmap: