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: 12757407 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 F145CC433EF for ; Wed, 23 Feb 2022 19:14:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244181AbiBWTO2 (ORCPT ); Wed, 23 Feb 2022 14:14:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233231AbiBWTO1 (ORCPT ); Wed, 23 Feb 2022 14:14:27 -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 5601531213 for ; Wed, 23 Feb 2022 11:13:59 -0800 (PST) Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (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 3342E3FCA9 for ; Wed, 23 Feb 2022 19:13:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1645643628; bh=7G3yQO1ggdyvs1MDXGTTghLlHGfX3RftlATUX++IZLE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=R9QPNmTgqpJQkzBnZcufPsqKiHSK6RpPxVG70CC2MXSEzrMx/RUn55X8bTWq+fUo1 /9tAoxuGS98iKMjxEZyxeQoGSpVPFXKZjOFI3EiHLjkDbfHUx/1+7u0W98+CPvHZt8 J3DivFq91XKtziYwIXQtMix8IeaWLzqaA+1dioFy1mvlHR4M07QcxuZTtK8mzDswPK 1o7d4EYZ3xxs/2XCSP9nvkBKBMa4b2vLXHPKlqhQx3ICwrNnE/7v4Np1l1UsaO/bz1 h4im8BaUKR2DENCCGIcNHmiTg+EaBOULnDsMvKZ0jmKQzabdkMK7NMnHv3R9qOCquD sJepQs5NiVfwQ== Received: by mail-ej1-f69.google.com with SMTP id mp5-20020a1709071b0500b0069f2ba47b20so7401406ejc.19 for ; Wed, 23 Feb 2022 11:13:48 -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=5t+aksCPKn7n7YXJQBkxJGzjkVahq5VAFGteK7jpuPwM2aDy+g/Y1kQzbFLQjZtfSq 9JxV/dBk+DguNr+P3lQq8Hab2NW9kTOluwmNm0mZyGCMs3BhnXx7PoHnP7w4kogf4S7U bM8HCQZIXBIP1RaOQba8IDL6kof+uwWJpyONJiLGlUDIL9L2fsh8NZkTCt+3XFpPboIv aLlxgkGJp8Gvlc6Tc9uHvQn37wT+YTykVFFrmKFBVJFDhqhGPFA7XsJuU4CXchxAj9t9 gqeFvhQUW//tXL5X5jusz5qQnGEmM1c/A/7d2EfRnZ/GhPE3DLGcCqPcSK7PD0LObj7o wZ1Q== X-Gm-Message-State: AOAM530NPl+sEHxnPbp7hIj/yB+IdtcvguNoPqgUcsNZsLRYn4oBsXmB NufWU5KMq04yY1ZMGlq+hY5IbjcTi0N7UADloK0dBonHptSh6vAKO3hUmjIDzW/KVHQAs6Fuqd5 AYrldx9gfURc83FV+fhgObf+UX1NWcU6OvCdVyTw9DS4xkBo= X-Received: by 2002:a17:907:3e1d:b0:6d1:cb2e:a5f7 with SMTP id hp29-20020a1709073e1d00b006d1cb2ea5f7mr912435ejc.34.1645643627844; 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-remoteproc@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(-)