Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1969652pxm; Sun, 27 Feb 2022 07:48:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkwev0/WA+57dx9lhgGRuPlgtu5R+5t1PBYlmMaZ03Xeg8HPYuoYN8F5gkQ1EwTrUSwptY X-Received: by 2002:a17:906:7d98:b0:6bb:b32b:d3bc with SMTP id v24-20020a1709067d9800b006bbb32bd3bcmr12118091ejo.126.1645976892705; Sun, 27 Feb 2022 07:48:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645976892; cv=none; d=google.com; s=arc-20160816; b=hCHfiFC+vbJsGQk8V1aVnNUC3zAgLesYPnRp3XA8CpL6tx3BESFq60mgheIsCkbP9v RMiY5p7YJ6CWmWQ/0j2KTGWRU5qhKppUxqYNCsB0GSTtlG47JJYj0fjqt1Q3gA1Qvc0r 9ptuKjOkKXORFTw1iKuU/u5MZ0dax5R4R60IX43VIggaUuOoKcNCYjxeDQFaRxFAM4NJ vxUpDpmK6hxaJPR+hi1TjjoQ5bALfy7BSluwKKxDZRNAB55pDjvO4763CYXFTzwosGhl PLmcqqYNppl6RM72UzYV/zLObiwRsM5UPZflBpvd+fkb9fWoHvP81UuPgm3V579MCZkk xrCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=x+DOMuEjhXppqlmSDNC0RKdzUzslcBqDhsGS9OsoQS4=; b=mk3jS7nn7nY3mYP00dkzZuLJ9VOIDSm/Nm7b2lYK/VMdLtlvukoB0INRS5he9icWMu MzOvUfwIjjnv/tOcGfpaDhuWLwpocy3pm7zP8lsZBZHsZWtt1aAwseCZWppqIcrSbaOE HLOTVsEMtX+EFRKSFSg/xc1pqRvWhGlOFW5BZU/LJgZYKqwrnplj2oP/akJO3Xwz5LDo Zg0JERVikEDe4mkCsKU/gEtEm1vdbjXlF1bzjkCwXoq5t7biEa2IiO2W7puxYQ7q31wz /JB+gAIe3AgD4roaiG9nhxe26KHMck+FniS3KBrayyxs4bUNdHVedpi5Ask8lW+Gp+ET s5QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=TVOVbta0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n18-20020aa7d052000000b00410cc13a462si4981418edo.328.2022.02.27.07.47.50; Sun, 27 Feb 2022 07:48:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=TVOVbta0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231143AbiB0Nyf (ORCPT + 99 others); Sun, 27 Feb 2022 08:54:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231285AbiB0NyW (ORCPT ); Sun, 27 Feb 2022 08:54:22 -0500 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04F481403B for ; Sun, 27 Feb 2022 05:53:44 -0800 (PST) Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.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 EC28B407AA for ; Sun, 27 Feb 2022 13:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1645970021; bh=x+DOMuEjhXppqlmSDNC0RKdzUzslcBqDhsGS9OsoQS4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TVOVbta0ueT8ZRURaUSUSMpiCRWXCaUi2ZGIkk6uD7987ADPOR5ImN8CseFr1uncU lvz5fH+do659CaVP1MZQdPXe0YuNqBT1i6fg8rmzXDSLJm4/o/pd+7DNcIyAw8EWxt 2HhMlH1L397N8uP0NwnNY+SfZVkWlYDmLQ0i7u7qnCOIE4VJOGEchiQn+mXcDO+VFI 7guOPGBfMCgdfUXtG0e6qh4ggfA4WL6WANe/imQ4fPSNgZTeB+m5mbCWIL6dZEM4Jh U3Oj5Q+YNKSGnra0mxalKc/jPgcJbtAI0yRqnocGgl+0uR3ZX3BMcGHXnMd0OIZNcB xEG6pyVhMh1HQ== Received: by mail-ed1-f71.google.com with SMTP id o20-20020aa7dd54000000b00413bc19ad08so73551edw.7 for ; Sun, 27 Feb 2022 05:53:41 -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=DIcPGMfCPxqgI/L5NfYSAjE5LeVGOxapzcZLq7Im9LGzJ7dS1Is8Ebs3BMQRPEM9uA Fu2v+Jn6YrQ4QWJRieHiojlc9DtWOeZystJeaO8Z3O3wSc3wlGmEVhzqdIv2O+Zg6H7J +UQYzsXxCxSuyf3xOBnhWT43N/XbjM2NpGRoSnRovtrtJYzgTaW57hbqSqPBL68Dh6N9 C+4v1dFT7iDNN8RntTuutNeBu+y9T5Qhc5+X3vxuDcCMO8ofGjYGzRwn7631Pq0XBjYD diP5/CBRCOF5hZkVIEvIdZ5+hQiDLwaUZcl0+EciCI2oHiJ2coRewKQ79YlednwQTp2t oV4A== X-Gm-Message-State: AOAM5332njOPMrUBBIk3kSKrWWe8Oq1YThFhIeQOiAB/gWhvBKfVNDaa qHItcb8NOmp4cDIRzfL+lKKHR9bjCFhQqO8iENGF9qv2QY5Z+FhzgFvJd0WD6ZCfvnBIMcT6dGU sQwkozLB6W3qSlA83ZIcoYlrpMkQOWlV8PEL/yQO/ZQ== X-Received: by 2002:a17:906:354f:b0:6b4:1449:2d03 with SMTP id s15-20020a170906354f00b006b414492d03mr13078947eja.197.1645970019299; Sun, 27 Feb 2022 05:53:39 -0800 (PST) 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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) -- 2.32.0