From patchwork Sun Feb 27 13:53:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 12761772 Return-Path: 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 DE7C6C433EF for ; Sun, 27 Feb 2022 13:57:05 +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=wMk4c9sA5crPsBFsPXyFB0A950rvwAgTKkappPeEJe0=; b=D/8mhC8qLAcMS3 HJKepKGCREVHi89WGPtJfvX1l1aHBqMvFwK3I92PC2kiyaromFTB1INRX7et1a5ogxugiTl74CAf4 ZeMR+M5yx2vyhRUK8bRil7RmI/pgIxytKzVpl0bR/ShoLLU7FVAP5tZihfCGFrR8D7lJVPUebeGVw PnkTqHqKtuhg2NlQ9KUko5ye+yHqiwHi1EcG+xVrnyBTkCR0Q9M+abE//K+pjs0/2idgEWglMM8Bb qRd9LVxr+TXQjbPYl2L8yzeNQbyqQ7F5D5QhmL1QdKWQsVjvIwQurhHAYg1p5+Xo4W2Id8VxzlIZj D6iFEITz/nttgIXmnuww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOK1S-009Iw5-MQ; Sun, 27 Feb 2022 13:55:40 +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 1nOJzd-009I95-1h for linux-arm-kernel@lists.infradead.org; Sun, 27 Feb 2022 13:53:46 +0000 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (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 9E455407C5 for ; Sun, 27 Feb 2022 13:53:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1645970022; bh=x+DOMuEjhXppqlmSDNC0RKdzUzslcBqDhsGS9OsoQS4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mFJlfNILKXD78bWnbRz/It9Ad4Pcp4lvPRHR8mCMjLBiTxYyLc03mYmL5KhqtUQnX wpmdFjteocPDQZUcKHT62lhfmSe89nlqZY9fDhXCPyzS61vJvrWYAU/snx55Xkma9/ yIBbWfgVOtN7vKiyKZOYuGdmY6DiYz+hcFfW/mv1Fs/gvu9c7d4ToF3YjWVrCK0cg5 FJBRJom3hNG0ELVFDOG3wAH6D2fxQ8sdgDO5zNE25Ml4eMMveFB5mTW6SnNE90u8EB katJmaUvJ9QlJlnsz71Ai8tZyN+idmlHK00tFk8C/rC79QE141aiNV75TA2RepuTjS bItB5fEapAwZw== Received: by mail-ed1-f72.google.com with SMTP id r9-20020a05640251c900b00412d54ea618so4217054edd.3 for ; Sun, 27 Feb 2022 05:53: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=x+DOMuEjhXppqlmSDNC0RKdzUzslcBqDhsGS9OsoQS4=; b=OLrR/DwyP01iu+1kAzDQDXws3eZseVGXxPtCNu5C19pXoNKnOn42PdjNkDDB3KjLIL Ar8FlblWMDaExlsjSeorBgsNEGyGkGj9zt+0AflP54Kzm78S/2s67YW93Rhj7gPVmcJm UYX8t18JRqnysyQQkSMFLj/ghedemN2nsvf2mGr0uiRX6P5FftVRHq+pNQlCWk6dDrxk j+wO6VxjlIXcEJa1OybHl3Ka3w2bYOa1w17anQBuulNZzVXqTlzMDF/xukcbyT8PiJAz PTKI/kU/vD7fiP8rV4jjJMzLYZ/v4nNSPRkeQ4FxLCe3DUJsV14HiShsrjVfyC10pf4n +Umg== X-Gm-Message-State: AOAM533xoaZPwlvdffksGm4Ts2QZlLoikHGVsw1TzVTYvNf4/ElR8g9W m7qS1HdKC8TF03iaB6Ne+V/56QoFBV0Pfy7nGDV5vtqXR/EEyZm6mn91aXC+HVi/JT/Zq3NFUWU r4WtxGKQ1t41QEWxgYkEzSd3Ixrg4IQTOjQEiZjCENF4UmOof+npx X-Received: by 2002:a17:906:354f:b0:6b4:1449:2d03 with SMTP id s15-20020a170906354f00b006b414492d03mr13078937eja.197.1645970019293; Sun, 27 Feb 2022 05:53:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJyLkm/ya1hWTxNWHY0owECzZBrknUNuVIsi2Y1TI9mIZSzwklvOz9AjjK7v7g0U5lSZuOzjqQ== X-Received: by 2002:a17:906:354f:b0:6b4:1449:2d03 with SMTP id s15-20020a170906354f00b006b414492d03mr13078900eja.197.1645970019102; Sun, 27 Feb 2022 05:53:39 -0800 (PST) Received: from localhost.localdomain (xdsl-188-155-181-108.adslplus.ch. [188.155.181.108]) by smtp.gmail.com with ESMTPSA id w11-20020a056402128b00b00412ec3f5f74sm4600760edv.62.2022.02.27.05.53.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Feb 2022 05:53:38 -0800 (PST) From: Krzysztof Kozlowski To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Stuart Yoder , Laurentiu Tudor , Abel Vesa , Shawn Guo , Sascha Hauer , Fabio Estevam , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Bjorn Helgaas , Bjorn Andersson , Mathieu Poirier , Vineeth Vijayan , Peter Oberparleiter , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Andy Gross , Srinivas Kandagatla , Mark Brown , "Michael S. Tsirkin" , Jason Wang , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-s390@vger.kernel.org, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-spi@vger.kernel.org, virtualization@lists.linux-foundation.org, Linus Torvalds Cc: Rasmus Villemoes , Krzysztof Kozlowski , stable@vger.kernel.org Subject: [PATCH v3 09/11] clk: imx: scu: Fix kfree() of static memory on setting driver_override Date: Sun, 27 Feb 2022 14:53:27 +0100 Message-Id: <20220227135329.145862-3-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220227135214.145599-1-krzysztof.kozlowski@canonical.com> References: <20220227135214.145599-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-20220227_055345_276020_766B939A X-CRM114-Status: GOOD ( 15.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The driver_override field from platform driver should not be initialized from static memory (string literal) because the core later kfree() it, for example when driver_override is set via sysfs. Use dedicated helper to set driver_override properly. Fixes: 77d8f3068c63 ("clk: imx: scu: add two cells binding support") Cc: Signed-off-by: Krzysztof Kozlowski --- drivers/clk/imx/clk-scu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c index 083da31dc3ea..4b2268b7d0d0 100644 --- a/drivers/clk/imx/clk-scu.c +++ b/drivers/clk/imx/clk-scu.c @@ -683,7 +683,12 @@ struct clk_hw *imx_clk_scu_alloc_dev(const char *name, return ERR_PTR(ret); } - pdev->driver_override = "imx-scu-clk"; + ret = driver_set_override(&pdev->dev, &pdev->driver_override, + "imx-scu-clk", strlen("imx-scu-clk")); + if (ret) { + platform_device_put(pdev); + return ERR_PTR(ret); + } ret = imx_clk_scu_attach_pd(&pdev->dev, rsrc_id); if (ret)