From patchwork Fri Aug 23 10:06:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 172104 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp427923ily; Fri, 23 Aug 2019 03:07:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqyK6Hm0WZt3QpQQfxkI13Ub8JZv2Ihpgp3ls5wQ1D6coN/7+eJ5x/8WGvx+o7WT/WBkrGva X-Received: by 2002:a17:90a:be07:: with SMTP id a7mr4342018pjs.88.1566554838716; Fri, 23 Aug 2019 03:07:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566554838; cv=none; d=google.com; s=arc-20160816; b=h1AOA4t8Z/Qd/2/Fn6TIHk3InGcOdjeKPR5kQpIl9aQTooCIp05/3kcZLITymBRsSQ krriuhUX86F2ST2tjE8KjshPvQIfCBWdx2fkotJzmbBjCrklE3S1Oe/YhnyxGKvrfIpo g1Sn2pxVj3YcJ0/H4Pxvy7Dl+NtaOJYpZbtWLkp66dYiqWH6bYf+yWCCTCZKpiqig1or Kq02Ur9q2nRRJa9Ng0V/NWaeytVtCkipBkXBIxVaq7Oqx8k7PoVXQe+bPV5y0DOwcDfv cSfLgTtEmP9TIt+Mad3Ym6pZqrpaRU/gJOHmFeROmJQcOP6wvRDKwaxb8JnSkXT4yS7r ZbhA== 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 x18si1972544plm.292.2019.08.23.03.07.18; Fri, 23 Aug 2019 03:07: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=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 S2392123AbfHWKHR (ORCPT + 28 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 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(+) -- 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); }