Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4479357ybx; Mon, 4 Nov 2019 14:06:59 -0800 (PST) X-Google-Smtp-Source: APXvYqzbYUeOB6uOfINECC3bM7S3+7N7Qfdc6tx+OCkxs6YBkFfWdrIVT2ZRkPEgqu7lye/B+1VK X-Received: by 2002:a17:906:5fd0:: with SMTP id k16mr15350475ejv.243.1572905218930; Mon, 04 Nov 2019 14:06:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572905218; cv=none; d=google.com; s=arc-20160816; b=mgcBD/BlNL5vBmxOxMCePAa5+nM9gEvtiMN2niRDN4F+Sq0lHis9NKSi4XJP5Sws1l x5HqekW8+QTF2GQY1+iTdcNIYf4O5U5Q3JwH/iAQgwt07wwM2ClwA/TnOxixyE6OxxXI mYELFmzpe5WpvzhdOq/sTqkM+0X6yH3tQ4EV252AwUoNgRz2USudi3HPJWjnwfXSV1og 0bMv/s838cHNWjGsec6PA/puE/JKwVz4Ya8Jak1c/YHjTlgdIVlDhKxbZzSBvk6uGrzJ /+Gfgm1vBzhWG8Fc6GHLRzw1n/kodU1908lLCK8kv8kNvYbWfAQTNyeDncsiHxFh6i0c EvRA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MthpJd0xzyHAtU0wohXXElfA3XHo4U9BVdUaR+vr1oo=; b=mtTdPPJCpnDknl1aUDoUNFST8Hgbmo9DzTIFAwo19A+Ep61ug0qOfTrk/A/Blol+T2 oFb7xcZpG5voOQRkmX3q7i6uQdC6ekCvr/qwpZDZZh8/d674AdsA+shUP2uDVAGFg6Cg s8O7/Bx0B63FBYHcPCMqRPqTbIoGGClXwyTNkToXHgi+yjI1ZAFokiE9qcieZKkN+xNS 5Ll7WdxotadzNYPbQILBx2npRxOFVFgbeXAI32V1DVrXTaNxt64FoRcuGJivtdJNY11p 3L8DLPBXz80vG3BfiFR9+ipWlgGoqfzREyCtUEHhPS2BSwpHPP/7Cz3N2O8JG9rt1pQF tAFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2MkFi2jO; 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 d15si9014998edn.49.2019.11.04.14.06.35; Mon, 04 Nov 2019 14:06:58 -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=pass header.i=@kernel.org header.s=default header.b=2MkFi2jO; 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 S2389305AbfKDWFb (ORCPT + 99 others); Mon, 4 Nov 2019 17:05:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:36814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389266AbfKDWF0 (ORCPT ); Mon, 4 Nov 2019 17:05:26 -0500 Received: from localhost (6.204-14-84.ripe.coltfrance.com [84.14.204.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9598C218BA; Mon, 4 Nov 2019 22:05:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572905126; bh=uA6XdKv2+2SDhsP+E379mscL9KCCmxo7feDnHtH9r3g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2MkFi2jO69Nu5wPgHisfE4gfHCrXVutyLdiEwUWRiglec9tIuCJCCvljwu1/XfXZE emtCDECvwfCcyzLXX4/f6CqnfI/DFcM2b+jy/jAv5bgQ/5s/Chp+Ovl33W12F0H/CM qaf1huj7D7w/r+zudtCFuFW6+DHDzJBPS7tH3030= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Navid Emamdoost , Sasha Levin Subject: [PATCH 5.3 036/163] misc: fastrpc: prevent memory leak in fastrpc_dma_buf_attach Date: Mon, 4 Nov 2019 22:43:46 +0100 Message-Id: <20191104212142.834864609@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191104212140.046021995@linuxfoundation.org> References: <20191104212140.046021995@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Navid Emamdoost [ Upstream commit fc739a058d99c9297ef6bfd923b809d85855b9a9 ] In fastrpc_dma_buf_attach if dma_get_sgtable fails the allocated memory for a should be released. Signed-off-by: Navid Emamdoost Link: https://lore.kernel.org/r/20190925152742.16258-1-navid.emamdoost@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/misc/fastrpc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 98603e235cf04..a76b6c6fd660f 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -499,6 +499,7 @@ static int fastrpc_dma_buf_attach(struct dma_buf *dmabuf, FASTRPC_PHYS(buffer->phys), buffer->size); if (ret < 0) { dev_err(buffer->dev, "failed to get scatterlist from DMA API\n"); + kfree(a); return -EINVAL; } -- 2.20.1