From patchwork Fri Jan 24 13:29:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 198178 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B92BCC3F68F for ; Fri, 24 Jan 2020 13:30:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 98CBF2075D for ; Fri, 24 Jan 2020 13:30:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389752AbgAXNaa (ORCPT ); Fri, 24 Jan 2020 08:30:30 -0500 Received: from andre.telenet-ops.be ([195.130.132.53]:42544 "EHLO andre.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387464AbgAXNaT (ORCPT ); Fri, 24 Jan 2020 08:30:19 -0500 Received: from ramsan ([84.195.182.253]) by andre.telenet-ops.be with bizsmtp id uDW42100T5USYZQ01DW4BW; Fri, 24 Jan 2020 14:30:17 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1iuz2C-0007bG-Cp; Fri, 24 Jan 2020 14:30:04 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1iuz2C-00047A-AH; Fri, 24 Jan 2020 14:30:04 +0100 From: Geert Uytterhoeven To: Greg Kroah-Hartman , Gilad Ben-Yossef , Herbert Xu , "David S . Miller" , "Rafael J . Wysocki" Cc: Rob Clark , Sean Paul , Felipe Balbi , Alan Stern , Thierry Reding , Jonathan Hunter , Mathias Nyman , Matthias Brugger , Chunfeng Yun , Bin Liu , linux-crypto@vger.kernel.org, linux-pm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 0/2] Fix debugfs register access while suspended Date: Fri, 24 Jan 2020 14:29:55 +0100 Message-Id: <20200124132957.15769-1-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi all, While comparing register values read from debugfs files under /sys/kernel/debug/ccree/, I noticed some oddities. Apparently there is no guarantee these registers are read from the device while it is resumed. This may lead to bogus values, or crashes and lock-ups. This patch series: 1. Allows debugfs_create_regset32() to be used for devices whose registers must be accessed when resumed, 2. Fixes the CCREE driver to make use of this. I have identified several other drivers that may be affected (i.e. using debugfs_create_regset32() and pm_runtime_*()): - drivers/gpu/drm/msm/disp/dpu1 - drivers/usb/dwc3 - drivers/usb/host/ehci-omap.c - drivers/usb/host/ehci-tegra.c - drivers/usb/host/ohci-platform.c - drivers/usb/host/xhci.c - drivers/usb/host/xhci-dbgcap.c - drivers/usb/host/xhci-histb.c - drivers/usb/host/xhci-hub.c - drivers/usb/host/xhci-mtk.c - drivers/usb/host/xhci-pci.c - drivers/usb/host/xhci-plat.c - drivers/usb/host/xhci-tegra.c - drivers/usb/mtu3 - drivers/usb/musb Some of these call pm_runtime_forbid(), but given the comment "users should enable runtime pm using power/control in sysfs", this can be overridden from userspace, so these are unsafe, too? Thanks for your comments! Geert Uytterhoeven (2): debugfs: regset32: Add Runtime PM support crypto: ccree - fix debugfs register access while suspended drivers/crypto/ccree/cc_debugfs.c | 2 ++ fs/debugfs/file.c | 8 ++++++++ include/linux/debugfs.h | 1 + 3 files changed, 11 insertions(+)