Message ID | 20220222132707.266883-3-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 39A05C433F5 for <linux-arm-kernel@archiver.kernel.org>; Tue, 22 Feb 2022 13:30:26 +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=HpFSaFvGG4Pmu4gblt6h37W6j83CfRXNjVJaJAFtND4=; b=dAUYhqi0wYrKmA wff4AMlsxK04hb4gvo5/IEHNBA4pTK3yaZQKQ4kfHxSlLeY2AIIWlmSX8UWR4G6CGkU/zKNmf3zap hTnbisTA8ww2JOM3t2Oavat4RGjbI+e8Xn4DSqSjI9rVYmenAnONus90L9JXqTSicVW9ESgOtI1H6 XyXXbfbFCv1udvgP8jaIRgOt2tVOM6+U1FxIQutSXPEb7290HpR+BoERbXjwloPdfSkRgbnI89qgZ oOK8VI8K8EP/gy8xi75EZjgtNuFlg/8i3yVf2yop/4fMvfAYYW5sTBCvcbSCDCKUuz92UVMQR2FEA Il7tVCEV3pzJXH/GS7tQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMVDz-009hC6-Qk; Tue, 22 Feb 2022 13:29:04 +0000 Received: from smtp-relay-internal-1.canonical.com ([185.125.188.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMVDk-009h5z-Jx for linux-arm-kernel@lists.infradead.org; Tue, 22 Feb 2022 13:28:51 +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-1.canonical.com (Postfix) with ESMTPS id CD38440304 for <linux-arm-kernel@lists.infradead.org>; Tue, 22 Feb 2022 13:28:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1645536523; bh=6XeuQoqUzMUksn+ZuaBzNCPcuTk2LLoHTJkT0DsbDHY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VKZlwWJ7g99WEIyofZ1MqRBQ33PrEKi+p/W7fixuZQiEB/2X+gc7Gr1iVWam0e3WU WitLCT92mAbGqReCm8y7JpBUs6MydgHKfP42Wa0RKywCLmybZslSxnPsQnxIWqbdMS Wh2bH6R/iRuOS/f46edLeQ1SwRPr4WjRlIKwSj9k+Njfw/eMmhKurQEr8LVtP2bptT DTj7i+gBtR9MDPAmIgpM00OfYXO9DwszqnfySNSSG2kdlGbws+f0lfuukin297dUab baGeaV8BHHyE5Kz8XyC7Nvrtq2ne0jQnhlJAYDJ12SNAj7wLVDL2deWf7FjC029JJe dFlN85JCHLnvw== Received: by mail-ej1-f71.google.com with SMTP id ga31-20020a1709070c1f00b006cec400422fso5743278ejc.22 for <linux-arm-kernel@lists.infradead.org>; Tue, 22 Feb 2022 05:28:43 -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=6XeuQoqUzMUksn+ZuaBzNCPcuTk2LLoHTJkT0DsbDHY=; b=rNofBsdrR+zi525d+pfo79Hb61MCJ6U15PbCd/HCayBcnyft3u90bS5GvMfJ+yONfH RcaAm5eVKEC6Aek+EejDGUNDZwqUr9vrGDUEsLbdpQ0JBgFO6RSNebQj5umahvKQNLwi q+gFHYhUdmTccGqSYQfAfufizQZm2rVWA1QoYJ4XVEYO1fOpfjs7VbilS9yjFAlNi0YX jHy7svnT1DqN3sTIehKUAkWAEQKXoQf136nbdkN6DIuiuIOGbRuVtCDzBiRYeOAlmgRv OdQ/bbhqucH+6y5B5X76mlceGBE1mIHn74Wgee4PEGvLmNCZaCw6/LZjPTH3xZBubNTp /Gvw== X-Gm-Message-State: AOAM5316NYYPPmag4gJdxaDoXltIYvTJQBPfgczBs0MWpiAd+wYsYQZm MWm9jG+2SyKgu6Y2ILm5hIFRdd4sMMg+1mbUVROKHifqtyo4MjezSgvWML71oooY62wsVhVl1v8 6A6BJ8M7gj5U6QYg4jffO25p7RyIMJti01j74o+BJTofRVfnRW27/ X-Received: by 2002:a17:906:1656:b0:6cf:571c:f91d with SMTP id n22-20020a170906165600b006cf571cf91dmr19602342ejd.377.1645536523432; Tue, 22 Feb 2022 05:28:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJymWh8nTis0+whBJdlEUIaYxkLfPNPRZyT/AbiwgON8MIxb/gad15tlt22GRXjxl9FycTeAJw== X-Received: by 2002:a17:906:1656:b0:6cf:571c:f91d with SMTP id n22-20020a170906165600b006cf571cf91dmr19602313ejd.377.1645536523213; Tue, 22 Feb 2022 05:28:43 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 05:28:42 -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 2/3] slimbus: qcom-ngd: fix kfree() of const memory on setting driver_override Date: Tue, 22 Feb 2022 14:27:06 +0100 Message-Id: <20220222132707.266883-3-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_823099_4424AD87 X-CRM114-Status: GOOD ( 14.87 ) 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/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index 7040293c2ee8..5987d8f8a8fd 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1455,7 +1455,14 @@ static int of_qcom_slim_ngd_register(struct device *parent, } ngd->id = id; ngd->pdev->dev.parent = parent; - ngd->pdev->driver_override = QCOM_SLIM_NGD_DRV_NAME; + ngd->pdev->driver_override = kstrdup(QCOM_SLIM_NGD_DRV_NAME, + GFP_KERNEL); + if (!ngd->pdev->driver_override) { + platform_device_put(ngd->pdev); + kfree(ngd); + of_node_put(node); + return -ENOMEM; + } ngd->pdev->dev.of_node = node; ctrl->ngd = ngd;
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: 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver") Cc: <stable@vger.kernel.org> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> --- drivers/slimbus/qcom-ngd-ctrl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)