From patchwork Thu Jul 16 14:28:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 11667721 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F4B813A4 for ; Thu, 16 Jul 2020 14:30:39 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 15E1E206F4 for ; Thu, 16 Jul 2020 14:30:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bjvoR0wG"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="G4oAcF1W" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 15E1E206F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=aEOh5XQd8gBWpCFkDBSoUL0ExKH82u86b4J5UsPgiJQ=; b=bjvoR0wGF8kJZtlQWXDLz7/h6B hJXA0nNMZWSnE3L53HwW19BZGAI6tAHfqKXZExEi+eviWehPj42aIP4ALFkbUtoe0/yCZaW9NMKas szeUX81AdOyjBlgICWt4aZKVFSBt+ecd3AbQsXFvxEZKOiZub1GXRUpoYI1MsXPdAhA+zC6m6U+rG 7oHh0mOymVMVpDDZdDMseSy+s9CZohtR//hBx+k7BntjQl6zreOtxNUcOmpM7bTo1drnoCLlpJN3/ eSJsCmQ5+LlYdI+SRWUfm+3ZLvn7OZe9j7mR1ABhu/LBUZfX5fFgbyqXyQ6khdCF1H1359LRShtF1 Te+5s9lQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jw4sc-0006yE-FM; Thu, 16 Jul 2020 14:28:58 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jw4sZ-0006xo-R6 for linux-arm-kernel@lists.infradead.org; Thu, 16 Jul 2020 14:28:56 +0000 Received: by mail-wm1-x344.google.com with SMTP id l2so11844740wmf.0 for ; Thu, 16 Jul 2020 07:28:55 -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:mime-version :content-transfer-encoding; bh=6JRMdst6t7X7TTp06c6DTXphcwzBl33/L2DKEvEWMHo=; b=G4oAcF1WPTVdBIfQ6w4eXULeQ2T9EmAs2gdHdIkD85BVqmrgSroOjiHjaFRsNv+ONM 11SpMBLH/32DcLe9/3OQXSFB+QpMyeh4A85hOTFlfBLndrUMQsln2TLZb+JGTaqqXxwW +nzB3p7n7MfL+bs62aknL2LPN3THFvneyLQNSNP6r2AdyEAxBS0ccFGXCF+90nu8kPVB e7oJqVZly8pPKFcbyYVTz83UsmhekrwEWFp4gtJS3xKSKtZuefKVn5dnPQrKK5z12g8W RDlsa0GC5XuWSi8r/5uXG0jkIlJwEjipOecoOCQ1Qfj8ZgU76eHA/fcSA1kHagm1A2sU BqvA== 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:mime-version :content-transfer-encoding; bh=6JRMdst6t7X7TTp06c6DTXphcwzBl33/L2DKEvEWMHo=; b=dPIEcUt59Sr4NiBrbvcX4mkdA3cyNifmH7ZXesXz8RRmDOw+4Rrx4TJ7NgUFKN1DwC QtThKxzYtRYW/JgAxkBYWA3MtF3LByR3gMmJqO5sHbQ0exWJ3e9TLLtpWHvtF0/ak3cP qLe8y6/4laOViVswjqZBa6ul8zvRS9SND0nCtiZ6hzxRwTEOnigYmJVDcfSL+ye/IM7F BZYpSeuQYAk8Fojqcs34yBOMOCw9gg4aJTxjIdN0Kqt5hfDCva9fNBO1PxLpoo8d4/Ot lOkrHsWAWJlQQ9YYimS5zJWGu9Hom6oGUijABLJRxrk92hGcxDt8SvjxARB4QIgt6VOw Ojqw== X-Gm-Message-State: AOAM5334mDbHjAUaG4DkiPCQCeteVh1RXlSIS7VwjruRxSBZytoAzKkE /YFgydJk9XsZU0QHlsIlGcP2/Q== X-Google-Smtp-Source: ABdhPJyHD8zrYi+EFetvc8uxd6vCIsnhmVFTMZ1dM9PRcghcTi/sTsarwrSdkE7Ex8nZ31dAkNCURg== X-Received: by 2002:a05:600c:204d:: with SMTP id p13mr4584426wmg.88.1594909734319; Thu, 16 Jul 2020 07:28:54 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.61]) by smtp.gmail.com with ESMTPSA id 59sm9749215wrj.37.2020.07.16.07.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 07:28:53 -0700 (PDT) From: Lee Jones To: lee.jones@linaro.org Subject: [PATCH 1/1] mfd: core: Fix memory leak of 'cell' Date: Thu, 16 Jul 2020 15:28:51 +0100 Message-Id: <20200716142851.1669946-1-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200716_102855_905523_32FA477F X-CRM114-Status: GOOD ( 12.47 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:344 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org When creating a platform device from an MFD cell description, we allocate some memory and make a copy which is then stored inside the platform_device's structure. However, care is not currently taken to free the allocated memory when the platform device is torn down. This patch takes care of the leak. Signed-off-by: Lee Jones --- drivers/mfd/mfd-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index f5a73af60dd40..e831e733b38cf 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -297,7 +297,10 @@ static int mfd_remove_devices_fn(struct device *dev, void *data) regulator_bulk_unregister_supply_alias(dev, cell->parent_supplies, cell->num_parent_supplies); + kfree(cell); + platform_device_unregister(pdev); + return 0; }