From patchwork Tue Jun 12 12:41:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10460143 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C3FA460532 for ; Tue, 12 Jun 2018 12:42:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3FEF2868F for ; Tue, 12 Jun 2018 12:42:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8D8628701; Tue, 12 Jun 2018 12:42:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28DAA2868F for ; Tue, 12 Jun 2018 12:42:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932905AbeFLMm4 (ORCPT ); Tue, 12 Jun 2018 08:42:56 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:40046 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932627AbeFLMmz (ORCPT ); Tue, 12 Jun 2018 08:42:55 -0400 Received: by mail-lf0-f67.google.com with SMTP id q11-v6so35777340lfc.7; Tue, 12 Jun 2018 05:42:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=oViq59vPotECR3ZPUf9zXySicgJKCAvGP6TUhvcq0H4=; b=mG62z0Ks3KOrF39szhZSgLll9s802iexXqxcGOFodfGTuHV89GEdaK2O2s6KtDa+4O S/k7uABK36jQCHpeRTt8/llmNfGyjzES8McpohmUAF7NNsfnW46xJofZEds+gZwqwcLn havFUtd1sS1/5ccvsO+HMdZpykfHbm0olvdEoBZyWw+ZtJm0NixUokivtXlet3Lpo1AG ziWg4MPOhF2OWd/Y66YLgwg0+2ixEyV6ujW+knh/+Lmh+avXNUvlYG+x5Ac2TB1HGDy3 OsbIwp/hkMs6z/sHkpZgQ0yamfTm1tp8s1zJJ+3+2NBjsYGTfHvKYqbbKZ25ub1BcvKD M+Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=oViq59vPotECR3ZPUf9zXySicgJKCAvGP6TUhvcq0H4=; b=LNVf9aexmiqX72gZHkCYOcyXxBptEel0Dt2pac7jFyZHMZQeEgQfNB2mlkV0keHoZ3 1YzEMnzT8skaVUsUFIeo0Gbg5exA3Qu9aQdum1ElRT05IpGzRxdA5reQfntrUCrFMfQy BhkMf+p8AWNH4UzkYs7PLunfJDOtceV9SLx7+dp1d04owIcVWpEsAtkFihxHmWMb93HJ /i+tGWOVTB5hKJk2emQCtPmwH4IrGF6MulfcBPVhlOvp7z3ack35WeRh1ldgylal/YUj LH1C06bJ7d8LqpiYH3XbYaYZ9jCUUzeSw0gSfBsXk8y1xe07dZjesjQjgvdtDdzh+Nfy TfqQ== X-Gm-Message-State: APt69E0SSWXGXtQJai8Nf4uASLpzb1Gqhb24JH6fDeQ2QreSeRaYf181 SG52ErfpzsehsFMi92d6zag= X-Google-Smtp-Source: ADUXVKLdXfLxFmAKoKtmy8Lxrw1wYfc2iMIpX/Ky0K7Tvi3Ou5D4ZblOSqucDe/i8IMDzf9nDYShyA== X-Received: by 2002:a19:7b0c:: with SMTP id w12-v6mr153599lfc.22.1528807373631; Tue, 12 Jun 2018 05:42:53 -0700 (PDT) Received: from xi.terra (c-8bb2e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.178.139]) by smtp.gmail.com with ESMTPSA id j7-v6sm19198ljg.48.2018.06.12.05.42.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 05:42:52 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.90_1) (envelope-from ) id 1fSid4-0001eu-Jr; Tue, 12 Jun 2018 14:42:30 +0200 From: Johan Hovold To: Andy Gross Cc: David Brown , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable , Bjorn Andersson Subject: [PATCH] soc: qcom: rmtfs-mem: fix memleak in probe error paths Date: Tue, 12 Jun 2018 14:41:41 +0200 Message-Id: <20180612124141.6307-1-johan@kernel.org> X-Mailer: git-send-email 2.17.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make sure to set the mem device release callback before calling put_device() in a couple of probe error paths so that the containing object also gets freed. Fixes: d1de6d6c639b ("soc: qcom: Remote filesystem memory driver") Cc: stable # 4.15 Cc: Bjorn Andersson Signed-off-by: Johan Hovold --- drivers/soc/qcom/rmtfs_mem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c index c8999e38b005..8a3678c2e83c 100644 --- a/drivers/soc/qcom/rmtfs_mem.c +++ b/drivers/soc/qcom/rmtfs_mem.c @@ -184,6 +184,7 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev) device_initialize(&rmtfs_mem->dev); rmtfs_mem->dev.parent = &pdev->dev; rmtfs_mem->dev.groups = qcom_rmtfs_mem_groups; + rmtfs_mem->dev.release = qcom_rmtfs_mem_release_device; rmtfs_mem->base = devm_memremap(&rmtfs_mem->dev, rmtfs_mem->addr, rmtfs_mem->size, MEMREMAP_WC); @@ -206,8 +207,6 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev) goto put_device; } - rmtfs_mem->dev.release = qcom_rmtfs_mem_release_device; - ret = of_property_read_u32(node, "qcom,vmid", &vmid); if (ret < 0 && ret != -EINVAL) { dev_err(&pdev->dev, "failed to parse qcom,vmid\n");