X-Received: by 2002:a17:90a:af8d:b0:1b9:3807:ce8e with SMTP id w13-20020a17090aaf8d00b001b93807ce8emr4311874pjq.62.1645538855362; Tue, 22 Feb 2022 06:07:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645538855; cv=none; d=google.com; s=arc-20160816; b=i2zejYA3anGHSXPYIG0vta/CXrsBkI4geBiq/7JZL4vKAauj40aG7Qgw7XDpWmQmFG nuAivbibTJrYfMPKtKh8JhBQwU56mPv/viz+Oq9Gjy36rzemgEPsj37EwrNol2BZjSyn oVyG9Gw+yunwp+vTfTuzhWMaRJkXgHg2GHBAxcyoS7o/li8kjVt9k6fzig1wtejTw9cC B1lJxpDeXnqYBJdpVsiaGwyu8H5YKrj79PR8R/M27FsLUAL7zXn/OvZVws6kUdG8nEHF js2jcvLJIWXEwR5nyabJqaUBVpo6hV3+O6M6Y9hLP7ky9Beu+8ATxCyAyyYYJefO4dEx tjsQ== 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=bxf6nJLttPRsL7dBKXZgcCS/RsJRiJgMR1Ys1z/0BT0=; b=CZ3HWwVPMvjh3xjgknNRHXPYwQCT2g1Cg32PNOweDnpEBhIiH8+edN8cbaFxIUl0ls 9+BZ+2d9o+OXKeolQNBiokng85YRvqGVzJVgpHfYirIpTy/bd4sQXeh1keG2juK5GE5U 8c9T/hV+aPQ7fQZs+aMWr1PZlvdEhaE0CzZfU8Qqt2UpvkXidKW7Wr2xOOINDVC1NnV4 9/C+Id6gmn8feO9+frRy0D5bvjQD6Cr2SLPRNIhJkotNWFb8MlefYSt8vS5n1VX+aj7D O+M90/ZF1zysIEgi+7//1VGZxLCPy0Sfk8VVuoIyMOF5SYextsuYAM9SuS1WJ1kSI54G KMng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=inPGJiFG; 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 y17si738576pju.71.2022.02.22.06.07.14; Tue, 22 Feb 2022 06:07:35 -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=inPGJiFG; 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 S232422AbiBVN3K (ORCPT + 99 others); Tue, 22 Feb 2022 08:29:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232414AbiBVN3I (ORCPT ); Tue, 22 Feb 2022 08:29:08 -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 8291597B93 for ; Tue, 22 Feb 2022 05:28:43 -0800 (PST) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (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 37442405CE for ; 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-ed1-f70.google.com with SMTP id l14-20020aa7cace000000b003f7f8e1cbbdso11943074edt.20 for ; 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=i1GgTwak9hhpjoa9ygsfeS3VfZrBSsuMUmOW/Il8my2nvfGStQhDq1DCv4cZHnfAQ9 QD4JcdxIgf7tv/LLDVlpmLMepYvM+IJLE0DUjxASCDVCpOllt+RSPFxfU1W6kk7HCx7T 98X25yu1arc7mF4qNd5IMv8tS218OepaUqalBc1x8pIOxY0LhCW6/lH37IEHt+88iSZI T+Q04qwuLgdnghMvOmYeyZLu21okx58RN+on4Qy5YkmO+A61dTcsXQkZPQ0xLPk+uqRB jWe9m3ZbbAwf+Pl9sbOY0M2K+oU9xL49XfacpXhs6Wlgtc6nZgziqHjsLp+XvL7D/f3n UL1Q== X-Gm-Message-State: AOAM532apb14wzfUguuC4Is/Xx6P+4NfkEMzXt4bd7S5ctihCsGN+r4Z F/8TiUjj5mD5FPycgVTjvd2w5ltmzEoEQlTOd+jCQk6C0VpIDupiSu+1QY/7vDbvP62l8PH8Vgf sijInFJls/mC4GMydAEuw2STPdit9Ellw87nFDgAGOQ== X-Received: by 2002:a17:906:a08b:b0:6cf:65bc:e7de with SMTP id q11-20020a170906a08b00b006cf65bce7demr19077979ejy.220.1645536521801; Tue, 22 Feb 2022 05:28:41 -0800 (PST) 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 To: Abel Vesa , Michael Turquette , Stephen Boyd , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Bjorn Andersson , Mathieu Poirier , Andy Gross , Srinivas Kandagatla , 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 , 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 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 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: Signed-off-by: Krzysztof Kozlowski --- drivers/clk/imx/clk-scu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) -- 2.32.0