Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1236210ybl; Fri, 23 Aug 2019 15:55:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqx8eRtgj7AMf1L2ekBqfUtk8sxG3c0jBUeDS9Z9+c/kW2NuAK2b0hrouEwQFyMTE1uUHEOR X-Received: by 2002:a65:5584:: with SMTP id j4mr5958591pgs.258.1566600943733; Fri, 23 Aug 2019 15:55:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566600943; cv=none; d=google.com; s=arc-20160816; b=xdX4bX7MkCSv6I8VkCZjw5IWfWbzWBLoEqnmWbZqDf19XxpQDCtcAzoAYAQ1rcNA2W 5XVLktRjqkVQyREgKCgmecFWSK2N9oJ9aWop64yjtg4SNlbnMW9znFL990McJ3opdgvf QRq2VT1O5Hum8vzPxkCQH1btyLCWlVC2xhWckUCecbNBeubaev+Uc6XKAN2nDf6rPwRA lSW8NafTX/N79yHT2wO9woDx4hg7cnM1Rou04KTeJpIGsEFed1qUhUz6fQSwcGlSqdOG a/Lk+rIADHjFxWlgs3tL0OhtXQWxHcEyKWtVyjNq4LJo/1dk1MIeNSOGfCFiLDfQNLtF UwMQ== 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=RT4dcpv/SyHVhn3E/KPjxw/y90HO2rqJQ3gkQlROIbJ4par4VvNUZKIRoaxxn1u3ik bZHFDsbqpFEm5FP981YootQtq25un4/0QRDzp4+BtdzuX0xB8jWLLHjQp5zOgbCdZQus GsI6NGCoCEN6TeLI3sVxFJo44XgNIXpNxpHZL5QrZZbXXqN2vdXP7q21VXng6ZYhXVEP 1bt6oM/SI9UBGawOCeM8E7refRKBpv+b6Cr5KeQonfWITElP+TKMs48zyaNG32oyxqI8 zd+Vp/N94V9dLl583k6p3jstp4QI1Bs0YiaNUv1IIE+5YKqqBJqULZgsB9jEbKIvC0VS Evhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zsLTQ6Oc; 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 x11si3814475pfn.171.2019.08.23.15.55.23; Fri, 23 Aug 2019 15:55:43 -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=zsLTQ6Oc; 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 S2392098AbfHWKHR (ORCPT + 99 others); Fri, 23 Aug 2019 06:07:17 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:54331 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391998AbfHWKHD (ORCPT ); Fri, 23 Aug 2019 06:07:03 -0400 Received: by mail-wm1-f65.google.com with SMTP id p74so8365892wme.4 for ; Fri, 23 Aug 2019 03:07:02 -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=zsLTQ6OcR9Dk0Qa39F2DDnmWFcluUGtQg+KpRb+bwLN1VIK3mhupCJbjkodp3dI4Fe iqWh9+beI2fEZPtXQqBILn5x5It/sxsv7zun4Zt7NVFJsPhAfH/gGhkWLaF7nzV25Hc0 Y6hQwhCfGnfnrHTNZljsbuzWLq9L02poSqq/DJOxzCk4+RvvBqiV2Z/5YZzof/Ut4PgM rSlB1fo+5JK7gqGVKFIa3UWXy2A+xNE3hLhLeLjzdhmTLmP4MXsdi7osPx/D/EFFnDwM ztznERXTlzizlp25hDlJ4CRX4E7X4+QrQsYOYPrtn6xK68tfMik0P0I788C2hxA69/YK MX0g== 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=eZxAw5J23RpPuP8joEyXEyTHYs9orshBXU7YAm5Va+3HWlNJvlziw9kvBAbexFuhRe bao2UuTwcX8l8/glbiMKQQHBe+1WxADSGgv+KS4hRPTKipaZwJuChLWWxl9j++3nbK7N dHjfAWuTrK3UxdH+QxriGSR5ns0MbNQYjU+uAA/LofGX3g7pnxENoTPEwt1kkrUhZiJY n3wf+BW3hwvNpAwh8YTOStW+6yCtMALg8/zfYzmhnqMDRbd5y3Sv4/m6kFCkVmsbQrRF BApniqLk7lIRAbAoV4E/czJw6QhAwhEiVjVkiXG/8B0XRVZZvnWia7M4nLMPM8if5Svs wlOw== X-Gm-Message-State: APjAAAWgJAsrH2OvIijSaGaYoeVJp/ZXGAGpgz2hsK9wcFrSylM3xo0/ lPSDpDfpL9hhrY1+poNANCzI/DNKwBg= X-Received: by 2002:a1c:a80a:: with SMTP id r10mr4148894wme.103.1566554821626; Fri, 23 Aug 2019 03:07:01 -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 q124sm2058048wma.33.2019.08.23.03.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2019 03:07:00 -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 5/5] misc: fastrpc: free dma buf scatter list Date: Fri, 23 Aug 2019 11:06:22 +0100 Message-Id: <20190823100622.3892-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190823100622.3892-1-srinivas.kandagatla@linaro.org> References: <20190823100622.3892-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(+) 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); } -- 2.21.0