From patchwork Wed Feb 23 19:12:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 12757394 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB37DC433FE for ; Wed, 23 Feb 2022 19:14:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244186AbiBWTO3 (ORCPT ); Wed, 23 Feb 2022 14:14:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233231AbiBWTO2 (ORCPT ); Wed, 23 Feb 2022 14:14:28 -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 651AB3FBCD for ; Wed, 23 Feb 2022 11:13:59 -0800 (PST) Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.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 41F54407C5 for ; Wed, 23 Feb 2022 19:13:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1645643629; bh=7G3yQO1ggdyvs1MDXGTTghLlHGfX3RftlATUX++IZLE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=HuslgOBVKpazvs1qEPddJ/Xn52DqkjreMXsOHYPOCc7S2w6GI7c5OYv3W3zJVAS4Q T8lz6y4qojznpimc+MZrbAvpEto6ZCQoKdZm5xU/Aa+Ny0p1rQBI8kjX4aj8/YscpD t9kodaF2sMek+6Tx4bWY+if1vWqI7859wKBKOZjyl/0vD48f9wpRBahE713ff4ins+ wmEXrpEfiF1od7dVBr7NPfF46JfOl9ww67zpcBgRaa30a0PoUAjiyV/DYWBgo1on6H Nvhai4DNgg5EAsazAfda/GoEwCwgdfPcVH5KxVW6pB5j23O3XdcaGuV/KrsEnrhKEF xL/ap7DWXcDGA== Received: by mail-ej1-f72.google.com with SMTP id sa22-20020a1709076d1600b006ce78cacb85so7514213ejc.2 for ; Wed, 23 Feb 2022 11:13:49 -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:mime-version :content-transfer-encoding; bh=7G3yQO1ggdyvs1MDXGTTghLlHGfX3RftlATUX++IZLE=; b=yZyWHztwWxLqEHQyO9/kdoJ97tdjzYU35aktYkCFHjlq5YwTFA0XUBAleEdjhXTVVY dOmOvlx6ZcoU+Hx1QHt1Cleyx7Gg7bJXcIpnO46N6a92k8rSkD0ZcMzNBVmZQ1yR58iL IEWrqHxQLcn4VCBGeljmWgY4aY7X74fRbepk+Pl+VSEWAAhdjnG92RZyuYQ43y5bFepc CM10ogDp4a0tD+OWAoxBAbpE/h1yrX6ng939PKnRg4scoohIL31V0kzspq4E4g///Tas XzPLeXbzc/TgVCkUPX5BI1D7y0VtY/t2RvF1fkLjK8K/c2l1aW9EXRThiFzqUvthiKR1 DjOQ== X-Gm-Message-State: AOAM531b88eQtnnj00ixEw3noVpdOpxZUXJ7NU+NwNmjMYn+naeMuFUf e/0dfbY6U8hAQwp/1DrkDh2TvnKsy5wLhUfytJBACypXlKj9VftOYbady2pvIinSTFEUPLDOGTH x82IWjadDl03pDVsi+VDVYHHozlb4LunnT3Uvbg== X-Received: by 2002:a17:907:3e1d:b0:6d1:cb2e:a5f7 with SMTP id hp29-20020a1709073e1d00b006d1cb2ea5f7mr912405ejc.34.1645643627831; Wed, 23 Feb 2022 11:13:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJzGBRIhr5hXOOi9m1HuHlbXHVVNJ7NbK5fFuNrM/4KQXFCcM1cXqPM7bQRPgfLpUUwT4AX8Nw== X-Received: by 2002:a17:907:3e1d:b0:6d1:cb2e:a5f7 with SMTP id hp29-20020a1709073e1d00b006d1cb2ea5f7mr912389ejc.34.1645643627533; Wed, 23 Feb 2022 11:13:47 -0800 (PST) Received: from localhost.localdomain (xdsl-188-155-181-108.adslplus.ch. [188.155.181.108]) by smtp.gmail.com with ESMTPSA id q5sm212611ejc.115.2022.02.23.11.13.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 11:13:47 -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 Subject: [PATCH v2 00/11] Fix broken usage of driver_override (and kfree of static memory) Date: Wed, 23 Feb 2022 20:12:59 +0100 Message-Id: <20220223191310.347669-1-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Hi, This is a continuation of my old patchset from 2019. [1] Back then, few drivers set driver_override wrong. I fixed Exynos in a different way after discussions. QCOM NGD was not fixed and a new user appeared - IMX SCU. It seems "char *" in driver_override looks too consty, so we tend to make a mistake of storing there string literals. Changes of latest since v1 (not the old 2019 solution): ======================================================= https://lore.kernel.org/all/708eabb1-7b35-d525-d4c3-451d4a3de84f@rasmusvillemoes.dk/ 1. Add helper for setting driver_override. 2. Use the helper. Dependencies (and stable): ========================== 1. All patches, including last three fixes, depend on first patch introducing the helper. 2. The last three commits - fixes - are probably not backportable directly, because of this dependency. I don't know how to express it here, since stable-kernel-rules.rst mentions only commits as possible dependencies. [1] https://lore.kernel.org/all/1550484960-2392-3-git-send-email-krzk@kernel.org/ Best regards, Krzysztof Krzysztof Kozlowski (11): driver: platform: add and use helper for safer setting of driver_override amba: use helper for safer setting of driver_override fsl-mc: use helper for safer setting of driver_override hv: vmbus: use helper for safer setting of driver_override pci: use helper for safer setting of driver_override s390: cio: use helper for safer setting of driver_override spi: use helper for safer setting of driver_override vdpa: use helper for safer setting of driver_override clk: imx: scu: fix kfree() of static memory on setting driver_override slimbus: qcom-ngd: fix kfree() of static memory on setting driver_override rpmsg: fix kfree() of static memory on setting driver_override drivers/amba/bus.c | 24 +++--------------- drivers/base/driver.c | 44 +++++++++++++++++++++++++++++++++ drivers/base/platform.c | 24 +++--------------- drivers/bus/fsl-mc/fsl-mc-bus.c | 22 +++-------------- drivers/clk/imx/clk-scu.c | 7 +++++- drivers/hv/vmbus_drv.c | 24 +++--------------- drivers/pci/pci-sysfs.c | 24 +++--------------- drivers/rpmsg/rpmsg_internal.h | 13 ++++++++-- drivers/rpmsg/rpmsg_ns.c | 14 +++++++++-- drivers/s390/cio/css.c | 24 +++--------------- drivers/slimbus/qcom-ngd-ctrl.c | 12 ++++++++- drivers/spi/spi.c | 20 +++------------ drivers/vdpa/vdpa.c | 25 +++---------------- include/linux/device/driver.h | 1 + include/linux/platform_device.h | 6 ++++- include/linux/spi/spi.h | 2 +- 16 files changed, 123 insertions(+), 163 deletions(-)