From patchwork Thu Jul 4 16:25:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 168483 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2469805ilk; Thu, 4 Jul 2019 09:25:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqysDk4U/BCtCKUXw23+/rx38w0R05n0sk5x1AOUCcCLOq9CcaXuSHiibRMR2qCDGhNVkxWC X-Received: by 2002:a17:902:bcc4:: with SMTP id o4mr49312589pls.90.1562257518665; Thu, 04 Jul 2019 09:25:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562257518; cv=none; d=google.com; s=arc-20160816; b=caqyhqcvFKBsdKM5jMw5Q4Zm/Y/fKGxn1Eg8w9NTyDqJYmgfXtCGXSx3ASP+m57p+m ljeWP7+xXnWx+94CB2fTLLvksIytqvaiXXP3vXqDundSeoBpeYCcv0VUzMPAURoox5TB AXkdDRPJ48l1l0d4sq+1MvrqfVl2zYx2RIwMOMN6SZ7Rh7wGV/O/I0c64JTPh3ylxIDW pihrNmuYewxvEAk7YWdvoaFGDY3qs8omepqSsvd6G9SFj1gsU2LYiuF3gduhukCvsnEd LRBLEGZC4w4T4nmK7vPb4q44mjYw1T4XmMMA3wZpMOIKcIjg9UJi6yp0eH7yG0NUm95B vddQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=vu3bIjwYWHnqxtGQ7M7Ln0vm9Kv3/gy3iOZGBSVw5C4=; b=glSidFXCLdSBfo1+gJaMjtCEjLQgpWdcBB29DvA0PJXpfYa+MHejySIdsg87JrC+wu Cw0B7AaBOj4QcrLseRlMweUqzIdxqI+DTjPEX/Hi7onw8SWdcF7Ax+ZayRM0AuHoNpro Wh8pnDEKwcX29WpveZTtoBboPcOM99YI0Nt0iYF3nkvJrFfvXpxSO1FzIPRDbNuptB47 vpkY+Rj/ugW+ChZhI65iiXkD8cXN1Ebs8oE4bnwSOjQpgzqSBktYYdNXZiKpj0uHI/r8 HgLr7VEdLSkOcd7PVY1cmAhjgm5pwbrKQgwvJHGwEW0bFy5HCjEdjOe2ISWtkGerMj1n n2Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M2XovPsB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j62si4525327pgd.170.2019.07.04.09.25.18; Thu, 04 Jul 2019 09:25:18 -0700 (PDT) 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=pass header.i=@linaro.org header.s=google header.b=M2XovPsB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727159AbfGDQZR (ORCPT + 30 others); Thu, 4 Jul 2019 12:25:17 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:53003 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726918AbfGDQZQ (ORCPT ); Thu, 4 Jul 2019 12:25:16 -0400 Received: by mail-wm1-f67.google.com with SMTP id s3so6280539wms.2 for ; Thu, 04 Jul 2019 09:25:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vu3bIjwYWHnqxtGQ7M7Ln0vm9Kv3/gy3iOZGBSVw5C4=; b=M2XovPsBg/LoExs9gVhoF6/bha1lZ/rlVY5BfJ+TpN8/kKlJSis3aDOKOtncwbx/3U QS8FlbprvGIJfbcieppMZkuUYRGx0UXYku1WjxirlRbehvi/UEnayX6q8BdG4KZ3R3nt Lfg61RNOrKMFqVtkHEmWiB7ZPdhWUdHJ/xPkV4qRa3epu7VGPXK6cN7YcFpFXrtz5yBe ouF5BS03XcqxfYqSAUucrDX8k7XtwP1aJGDUVASBIMG4lxOwSQUejLSN3Vf+ANViohTW wX6v/GHvrZFlbAODmfKDggK4wmX6LMjPcmRUoay8EtIuFABvIKgecek7IEs3EnPnAHcC eKAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vu3bIjwYWHnqxtGQ7M7Ln0vm9Kv3/gy3iOZGBSVw5C4=; b=D0gFVMR11Q/kNK4jRBYQ5/dcpSWSGTfuXuh95W3Zo056p2qiUz6NRrivebnV22rLpk 5RrIZXGX2DZxCjwQe8adV/+w/KHQSYAonpsHfRN9GxIIO55GV/sTLobPEcMkGtP3KT6T JGBWVurqgZpU15vZ+wDaTRFqaBxTqb/MoNTEN3wgmenXEgtQLBMcZe/yp/PW8d4+tx/o sKTbXi3A0RSJ4z/kFVXABTh6vM+NYgI78GsK0cnNGxFu1NUNr8WBKErEOyR3EmrInfzk +d1gpwFxJSyDDpDy2OaiDCqyZDEZFYIZiCuzhbZ8CbVPR26Q56Lnixu8HZNYuuAlnLLS shPw== X-Gm-Message-State: APjAAAULE7Vix0BgPH101jSLyaCyuhjYuIENhvUJ4yWvmYB3GBpWVePu oko8p1K+d+pxzi3WLsXiMFTH2i6QW8A= X-Received: by 2002:a1c:6a17:: with SMTP id f23mr233672wmc.91.1562257514827; Thu, 04 Jul 2019 09:25:14 -0700 (PDT) Received: from localhost.localdomain (30.red-83-34-200.dynamicip.rima-tde.net. [83.34.200.30]) by smtp.gmail.com with ESMTPSA id u6sm5780280wml.9.2019.07.04.09.25.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Jul 2019 09:25:14 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, arnd@arndb.de, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] misc: fastrpc: fix memory leak Date: Thu, 4 Jul 2019 18:25:10 +0200 Message-Id: <20190704162510.23093-1-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Deallocate the buffer when no longer required. Signed-off-by: Jorge Ramirez-Ortiz --- drivers/misc/fastrpc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.21.0 diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 98603e235cf0..af8fd2101a1d 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -279,8 +279,10 @@ static int fastrpc_buf_alloc(struct fastrpc_user *fl, struct device *dev, buf->virt = dma_alloc_coherent(dev, buf->size, (dma_addr_t *)&buf->phys, GFP_KERNEL); - if (!buf->virt) + if (!buf->virt) { + kfree(buf); return -ENOMEM; + } if (fl->sctx && fl->sctx->sid) buf->phys += ((u64)fl->sctx->sid << 32);