From patchwork Thu Aug 29 09:29:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 172550 Delivered-To: patch@linaro.org Received: by 2002:ac9:5c4b:0:0:0:0:0 with SMTP id r11csp2072214ocp; Thu, 29 Aug 2019 02:29:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxtEO6c1Kqw8FKylVObNiHsp68S4eUNOrJZyPmWyhP1I7/9uoH8gypjTgQWtUuwJ+Un1IUc X-Received: by 2002:a17:902:f217:: with SMTP id gn23mr8779913plb.21.1567070993284; Thu, 29 Aug 2019 02:29:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567070993; cv=none; d=google.com; s=arc-20160816; b=woyQAE3X0WT0zHIssxB4ZnHZc4Zpi481HlSgENxGRJWQnGM8IUNky59ksNRqiOBKJy 5szlhSCPKVL7iXb8q0bYQXghuB7x6Af4Lt3nIalt5F+EgBK5D2tx0FTgGf5xPC+nY113 r1uibXTO8kCd3xAyex/o8kSwCpLEdKol/UDotxBhI+Bb8JSAdaAGPA7SWepzlO9Z5oFR QMMDYjonuWbBGPYwSm12CMEY9tVqExk9H+hkKS013mBk2Lk7MG+0kfKpZE33oZRVExbt NW8QQTTbpDrWG9kn5yz2stHE32YJhT7Elw/GC6CBgjRx/B3LRKN85zJEAGLk6TwpbfGn wo8w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=txsHPtmH/4H2/WnX6EiFrXzeHkL+qrKcHt+2DoU5kzQ=; b=PP2BWB9cjbWSk52bgo+I3GMQvzKq1Ewwy4yQ/ryfiLKiCZLPrmySmr0dlP75dIQpmq 8pFzWq6A8vaCo5Z2res24cuegmkMyE6PAZQphwELtdBH1eUxX1xk6L7f/Yb45398M2eN CqUYBT0GDUOkrLfTWsZXaRXWlwfjLE5YuTJdybJlT/bEh5xhvWhw25I1JSvFYuacxoqK NVwjNJc3jrH/Ss0rgQdRb+FN9zcFsg3tWqSOnRgrHcZhtirpZBCPil45CIcMns6jvWfd BR1Hhdcvupin403u6Nqhy/tPvwcCxZyque2+rez7w3R/mMPXYotbv4pxjG/8CdUQUzdG e+gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xRwJYrUX; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 t7si1725600pjf.74.2019.08.29.02.29.53; Thu, 29 Aug 2019 02:29:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=xRwJYrUX; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1727176AbfH2J3o (ORCPT + 16 others); Thu, 29 Aug 2019 05:29:44 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:43806 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfH2J3m (ORCPT ); Thu, 29 Aug 2019 05:29:42 -0400 Received: by mail-wr1-f68.google.com with SMTP id y8so2636382wrn.10 for ; Thu, 29 Aug 2019 02:29:40 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=txsHPtmH/4H2/WnX6EiFrXzeHkL+qrKcHt+2DoU5kzQ=; b=xRwJYrUXbrpjGAWB4+R5fH7G0mRDkrSB5nnGWG4+zYs587hY8Cesq2JqG0vUTu0shm 5pkphlWZMXlMveg2S4oPS4BdCQp2Mnchh4Ih0wV4GdImugyPNv/ZM0MA3she+V9WXGWU BIretLX6+0BXSa3pOq9OZv9oxXVx8pLDf9VNglZBXBTOuIjqJQ63fAQnH8yB/WoV8lxJ Q7aWiOA/e79K4dnGQJ0uBooFrp4oD2jiMo/YosYL+IqpZRMk9m18+GjoTP70snfB5NND zZadvljCyol2fsr5UIoZl+vVT1xk+csmPx3MmyUoosgeuNBmiciKo4MlvIDgOc+ntJ54 g+HA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=txsHPtmH/4H2/WnX6EiFrXzeHkL+qrKcHt+2DoU5kzQ=; b=nPPqZjk22ZLKxHaOeCRE9/Fz36aLnwJEf7t8sz9ZHSf9v/8eXTsSWy/lMuCmav8PXL WLpzr280XE5lnDaibh97AXnwqFd6GIbCCN57Daa1Kil9CV/t52fE9GuNASBdKTiA2UmE 11u8tXN809Y6aOTvRbBzN0FSQJrlzBupAxy0GQqC/0Vj158UZS5gO22umK5HSt7uloMM oP6V3KsLrDtnGLrCPs6NjzvYI7WHBj0U39FrrEw+SyzudsgICcJyYBawdNyumhMgzacl j8+I/9rSzri4H0fokB1mHqTbjqlaTU2niGTPgwEoiM1yU49IEagWIOBGoC28aKMYncg8 YVTQ== X-Gm-Message-State: APjAAAWtwLJIjStyKNwV/f0ODzafsRyvQigQUaLIkPJcMNe3fTi/9+1r tOBZHbwMd4EiuZvIdYuLN+zW2w== X-Received: by 2002:adf:a55d:: with SMTP id j29mr9662074wrb.275.1567070980206; Thu, 29 Aug 2019 02:29:40 -0700 (PDT) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id f197sm3609512wme.22.2019.08.29.02.29.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 02:29:39 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: arnd@arndb.de, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla , Mayank Chopra Subject: [PATCH v2 5/5] misc: fastrpc: free dma buf scatter list Date: Thu, 29 Aug 2019 10:29:26 +0100 Message-Id: <20190829092926.12037-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190829092926.12037-1-srinivas.kandagatla@linaro.org> References: <20190829092926.12037-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org dma buf scatter list is never freed, free it! Orignally detected by kmemleak: backtrace: [] kmemleak_alloc+0x50/0x84 [] sg_kmalloc+0x38/0x60 [] __sg_alloc_table+0x60/0x110 [] sg_alloc_table+0x28/0x58 [] __sg_alloc_table_from_pages+0xc0/0x1ac [] sg_alloc_table_from_pages+0x14/0x1c [] __iommu_get_sgtable+0x5c/0x8c [] fastrpc_dma_buf_attach+0x84/0xf8 [] dma_buf_attach+0x70/0xc8 [] fastrpc_map_create+0xf8/0x1e8 [] fastrpc_device_ioctl+0x508/0x900 [] compat_SyS_ioctl+0x128/0x200 [] el0_svc_naked+0x34/0x38 [] 0xffffffffffffffff Reported-by: Mayank Chopra Signed-off-by: Srinivas Kandagatla --- drivers/misc/fastrpc.c | 1 + 1 file changed, 1 insertion(+) -- 2.21.0 diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index eee2bb398947..47ae84afac2e 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -550,6 +550,7 @@ static void fastrpc_dma_buf_detatch(struct dma_buf *dmabuf, mutex_lock(&buffer->lock); list_del(&a->node); mutex_unlock(&buffer->lock); + sg_free_table(&a->sgt); kfree(a); }