From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2AEA33F65FF for ; Tue, 17 Mar 2026 19:00:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773774003; cv=none; b=njS3aMjyWjgwj7iOOsGUZkwz+xsJGRgwulZZ+VOJPNfZQEWmX8nM9b63Dkh0K122wnaHEcfuXZhZu6XQYzRhbtMv9hgO2fGQct024x8EUBW3EqjqpzCkv00RgpHJg9TBDHUYCUbpL7+QVH0JfKlDva8oDnFqpCaQi0D/lKsI7x0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773774003; c=relaxed/simple; bh=7toBs7ZZhUyluOq0svKcjp6u10Tro12z91fbmv9V774=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Hf4A9Q2kLkMnekfo1Yb/ILkk9LByrmfOERCCLT6n8lpnzf+sgFff5jdNCsKwwzp6SZH7lYW/5LhLE/mBTJishnNCo/5mJ6JBUAvr/DJFg4ZbSIAibG1LDPImk+OQq8kP0YgGCKiASgC10Q1OoMgzal4th5t5dG1cdv/PVi7OlEU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JnwgLi/B; arc=none smtp.client-ip=209.85.216.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JnwgLi/B" Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-359f35dfef6so3163915a91.2 for ; Tue, 17 Mar 2026 12:00:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773774001; x=1774378801; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=1PcwMDnihsdnmKVOsfDRGKcGqZ39RTcsdWpVCxqwOIE=; b=JnwgLi/B7PR6QTTpALGIGGvsYdQe+j2j1HFQ2ktbZlbIPHWRPiQtzaco1IqdtDXCrC lSTjjsAtkMBmxvTDduAJTEyu/KlFUjcK3JfJ5dd8+lVad+5IDl6zOC7qb91xqCF4TgJP PoNFTrok3z9kL4n0uS6Wu70ofR65MogRYgeqSljKglx8mjeUOQy0dnIS4VVxCtW0h2uJ /wiXVwcddTTgOu83lMcFj//5IeMk+D/pE+pKOIdAJCPOBfA0eAqPS23nckHGi8xg5ubL fXFJZXoXmczb0B/NEPM7LSRWnT/i/ImqRRwMrKcC+vfIWDn2aNhu5mWhUwcL+LoK5ed7 9/6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773774001; x=1774378801; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1PcwMDnihsdnmKVOsfDRGKcGqZ39RTcsdWpVCxqwOIE=; b=DFqSsjzWKoSwEI8/rx3s8qqclHx+E220TsIAibkG2KOcnDPZan4nduRngEWEGrb3nC DqlEp34J5HB4Gi3p40q6xUrcqHqmnPV7a16Di4zi9U6dFodx4qCf9m6s9Dqv0wFuFRmm 8//0MhEj1py+bfbG6t1mDJ6+T5mZAz6lTgaSbEmgAsNLHCdtmWBze/rR25AAVZZT7m1K ZdaHd/WbXfrAuhP02gfPW3PbZk8y/kXw+jv4J6TQLHzr4/q4Ybgwli3YmNP+WPUKiADK FQdaUoPLbzlC4SDFN9XnTXSwLBPbJW5MoaDY6sUGRAOvTM2HscCYjn47a6hoKrQHyjht lUoQ== X-Gm-Message-State: AOJu0Yx16sA2XxvPfelanjuG08MspouaR9LpCOAYlu9pyWLIoQ3itTMV u3RPnc/SLhIXJOJK3oprEPZHDeHE/ODgxpdv/t3I4/2Ygp8LlHEADg5y X-Gm-Gg: ATEYQzwn7t7uHihM4mGO89Om9HiOwmxmnZFD0a2PgDqtyFjpId4PeEkpFW1iB7Wib4O d+Fmazgu8v+A6aCCEWGNcd/hSP3mM7qXC6zBWZKfH1p+QH91nHNQJCNUgVy0auJifLStkUtnQuW q9GhelsfTQldKpPxeQPg9c3pOvGbkKSvmOdsHgkdMtaDu1+qnGGur+VGuUKSMRNJPU/R0N02hH7 M3ld07aFeoe96cfiWiNMi/CVgzL6qpKB9MfOYX96PxGGYkYGuTgw97dQWHS9xtm5ES626DQvOAW 73Ea6+gkXBP2k+alE8Hpaz2aWfNBxeOvEB32RPm77P2eL+I4lXHCg/wne0Vylq4h5lFTnP/HXkm SX2JOoqdDUytvt6JAfnuSHt45cotvbInDIhh/0uGsBraKzrv0r2UjfunTD2Q0RO3tRlRPy3d7Fo u0Twswz6Cj/tWPKBydTT2eAcVF42u1kANDBDeX9TNgDTRt5wIBLMR1W8t5oGe2YkxHvob3gDa1O pOu8iPJo0LbgLBLLNLGW9wIdyKbefOXMd5WQn52JPIhnzTHgrvywQjIqkS/PlHcSpuuvg== X-Received: by 2002:a17:90b:1dcd:b0:34c:35ce:3c5f with SMTP id 98e67ed59e1d1-35bb9e45688mr490920a91.5.1773774001443; Tue, 17 Mar 2026 12:00:01 -0700 (PDT) Received: from 2045D.localdomain (76.sub-72-110-123.myvzw.com. [72.110.123.76]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35bba5a2c60sm196240a91.9.2026.03.17.11.59.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2026 12:00:01 -0700 (PDT) From: Gui-Dong Han To: gregkh@linuxfoundation.org, dakr@kernel.org, rafael@kernel.org Cc: linux-kernel@vger.kernel.org, driver-core@lists.linux.dev, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-sound@vger.kernel.org, akaieurus@gmail.com, me@ziyao.cc, Gui-Dong Han Subject: [PATCH 0/4] debugfs: disallow NULL string creation and fix callers Date: Wed, 18 Mar 2026 02:59:09 +0800 Message-ID: <20260317185920.43387-1-hanguidong02@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit A recent bug report [1] highlighted a NULL pointer dereference when reading a debugfs string file created with a NULL pointer. The community discussed the issue and agreed that creating string nodes with NULL is invalid and should be forbidden at creation time [2]. Since no fix was submitted following the discussion, I have implemented the agreed solution. Patch 1 modifies debugfs_create_str() to reject NULL pointers, returning early and triggering a WARN_ON to expose offending callers. Patch 2 is a code hygiene fix. While modifying the file, I noticed the EXPORT_SYMBOL_GPL for debugfs_create_str() was misplaced far away from the function body. This patch moves it to the correct location. I carefully audited existing callers across the kernel tree. Some drivers passing NULL have already been independently identified and fixed [3]. The remaining two subsystems (soundwire and drm/i915) are addressed in patches 3 and 4 by initializing their respective string parameters to empty strings (""). The existing logic in both subsystems correctly and safely handles empty strings. [1] https://lore.kernel.org/lkml/17647e4c.d461.19b46144a4e.Coremail.yangshiguang1011@163.com/ [2] https://lore.kernel.org/lkml/2025122221-gag-malt-75ba@gregkh/ [3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8cc27f5c6dd1 Gui-Dong Han (4): debugfs: check for NULL pointer in debugfs_create_str() debugfs: fix placement of EXPORT_SYMBOL_GPL for debugfs_create_str() soundwire: debugfs: initialize firmware_file to empty string drm/i915/display: initialize string params to empty strings drivers/gpu/drm/i915/display/intel_display_params.h | 4 ++-- drivers/soundwire/debugfs.c | 5 +++-- fs/debugfs/file.c | 7 +++++-- 3 files changed, 10 insertions(+), 6 deletions(-) -- 2.43.0