Message ID | 20220222132707.266883-2-krzysztof.kozlowski@canonical.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DB3ABC433F5 for <linux-arm-kernel@archiver.kernel.org>; Tue, 22 Feb 2022 13:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=t/3OXfTq30Ew8jXRKJ2ShCLj7riac8/vTlrDVruvND8=; b=KfOAxozWmAu1bs AgewVI6uYzogG0kzrS8WvK0nlY7u4RsnqkR1CdFiWQ+NV1icnzsavQPNaGkh3wEFZRGB+BXWkGYgV 2K35100aTld6/49aW/zqSDmrh4yDGO1MaLSf0mDj3ig8i+MPSkPPJwc5vjlTkKxeRWBa5UVkDjEyj nlWBgQ9v+3ok2lFqyBsABSe77Xg9WSoOg7RBhNRvwcAG+cMshaqH7PJboVd+FOzjU8FLQd9AYDf7o /hmSnKQz/7kRebiVfKayrYUjZuu6WbV9C+9sZ0PrfTMqiGvVx/iMUDma8OhY0t9n0SaWiSCuZjOSc 4umxuycsBo1GgjxvuvzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMVDp-009h8v-VD; Tue, 22 Feb 2022 13:28:54 +0000 Received: from smtp-relay-internal-0.canonical.com ([185.125.188.122]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMVDk-009h61-H5 for linux-arm-kernel@lists.infradead.org; Tue, 22 Feb 2022 13:28:50 +0000 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 1D68D40257 for <linux-arm-kernel@lists.infradead.org>; Tue, 22 Feb 2022 13:28:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1645536522; bh=bxf6nJLttPRsL7dBKXZgcCS/RsJRiJgMR1Ys1z/0BT0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=inPGJiFGhpmqpC1lplrkZmDrG4enItXj5xARB4lc5cdaeYCynhjHV2uOwA8PmECTy +p18O+fob5cZLtKcwYR5rkT35eF76SFdv5eeC3b+0QpiJFGGJdva3uMcBpI5pzJXut XR3oQR1k3OsUZzL10usZUAPNg4IdlM9iVm3K5096lfFrrjknmUjOtHlBfD+61UtmC7 qR5tY01GVdFkcVaF/GJtQmL3SkJH9gEjIRuyNSbWhdUuk0ZDNnuLfU1+2ni/BpR71i f5/y3xmggk2fVxa9ZfH0oDnj0i9qPemKf9NkxtOmUV9HAV4pXPe8k/oIMl6caNXTPO Kbn9U5mt2m0xg== Received: by mail-ej1-f71.google.com with SMTP id mp5-20020a1709071b0500b0069f2ba47b20so5694754ejc.19 for <linux-arm-kernel@lists.infradead.org>; Tue, 22 Feb 2022 05:28:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bxf6nJLttPRsL7dBKXZgcCS/RsJRiJgMR1Ys1z/0BT0=; b=sbzJEoTvIvjpKRcYS6WHRzV25EI57uIg9Ve8djcqCyv4M6Z8z3xJY95z6OrkRXuOiO RgVBPMnknG6R1LKxnCHcLSP/rRCqAXaAxe7RMr3jvtHQ4EWzyJy7Z9AgMSBuC2nzpSxt aVkTc1ErV3vS7jDiL9Z/P0Pj9E40pWX/jcr8mm2OIKugzs6Rb3djG1eYSdviqU6jXnUz pDRcWn4gy8nib3d5X6CIuHghTYzH05dblDLpGHFgrUOsxEuT6OudPvf3VAHfRtvvQMde PXKSpk9II4FJ1cvy0cXoT624eBC2ZxW97oYBMmlC1Z0CWXb+qivJ6kbSi0+Jp6uZv8F0 apRg== X-Gm-Message-State: AOAM532yxE9yxl0Dri/8cYci91PWNXtNnYuDlunY3CMCPSO/PdwohpkS DExjUPOUPzyYosG465qQghNb8ZjjEjHJcC2+5qlrYu5reCCq0iYlvlqQE466T5tFHuhpZZ4B0op 1JEnuR2dOt0zo3ee6RVZ55nrzhzgP6La7X61pKci1J1TS6os3Squt X-Received: by 2002:a17:906:a08b:b0:6cf:65bc:e7de with SMTP id q11-20020a170906a08b00b006cf65bce7demr19077964ejy.220.1645536521799; Tue, 22 Feb 2022 05:28:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUTH4XEfwD3KKh1b8myIZr/sth4y54qNnWupnWL+QunNk7jf61nPg0M2zH6cCPLQ41ESwuWQ== X-Received: by 2002:a17:906:a08b:b0:6cf:65bc:e7de with SMTP id q11-20020a170906a08b00b006cf65bce7demr19077951ejy.220.1645536521622; Tue, 22 Feb 2022 05:28:41 -0800 (PST) Received: from localhost.localdomain (xdsl-188-155-181-108.adslplus.ch. [188.155.181.108]) by smtp.gmail.com with ESMTPSA id c5sm10029875edk.43.2022.02.22.05.28.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 05:28:41 -0800 (PST) From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> To: Abel Vesa <abel.vesa@nxp.com>, Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org>, Shawn Guo <shawnguo@kernel.org>, Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix Kernel Team <kernel@pengutronix.de>, Fabio Estevam <festevam@gmail.com>, NXP Linux Team <linux-imx@nxp.com>, Bjorn Andersson <bjorn.andersson@linaro.org>, Mathieu Poirier <mathieu.poirier@linaro.org>, Andy Gross <agross@kernel.org>, Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>, stable@vger.kernel.org Subject: [RFT PATCH 1/3] clk: imx: scu: fix kfree() of const memory on setting driver_override Date: Tue, 22 Feb 2022 14:27:05 +0100 Message-Id: <20220222132707.266883-2-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220222132707.266883-1-krzysztof.kozlowski@canonical.com> References: <20220222132707.266883-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220222_052848_708413_2C75E48C X-CRM114-Status: GOOD ( 14.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
Fix kfree() of const memory on setting driver_override
|
expand
|
diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c index 083da31dc3ea..78ed40a0e3e2 100644 --- a/drivers/clk/imx/clk-scu.c +++ b/drivers/clk/imx/clk-scu.c @@ -683,7 +683,11 @@ struct clk_hw *imx_clk_scu_alloc_dev(const char *name, return ERR_PTR(ret); } - pdev->driver_override = "imx-scu-clk"; + pdev->driver_override = kstrdup("imx-scu-clk", GFP_KERNEL); + if (!pdev->driver_override) { + platform_device_put(pdev); + return ERR_PTR(-ENOMEM); + } ret = imx_clk_scu_attach_pd(&pdev->dev, rsrc_id); if (ret)
The driver_override field from platform driver should not be initialized from const memory because the core later kfree() it, for example when driver_override is set via sysfs. Fixes: 77d8f3068c63 ("clk: imx: scu: add two cells binding support") Cc: <stable@vger.kernel.org> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> --- drivers/clk/imx/clk-scu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)