From nobody Wed Nov 04 06:36:24 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jKG1T5Thfz6xqKW for ; Wed, 04 Nov 2026 06:36:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jKG1T4CqTz3NsC for ; Wed, 04 Nov 2026 06:36:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793774189; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/+Gl8XHZRSUds8dZ6vHfdG3KUr4Gyk0QrRchNQU56H0=; b=Qz5Mlc11CZhVTKAu4mVJ0OAT8DFKMj92HAAqE+5kN2T8QH3GeGRVk6id4EKKpobTTWhZn2 02hahOCaNoiL/lIqDl1xZ37s7AHKgPysDSoCcu0YA787htEw5m6BPlxFHzu8Kt5cs5/XTc H4YyChPv5qnOgidywtR2aXanUM5gOkUiP0bgQRJL357T0mxIvTR7yMfHROjOnBti5kAhzP FFlk0atv4InT/gHPd8If4a0HMGhxFNrolt23qtkXNUC0eN4tsH4Lfc4zgdlRVjMtGDX33l nuuapyWYrYDm7FAsGRZ8XgIaWPjU9G8Y58/lgA0liYUdMpCQ5WcAgYKBS3xE4A== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1793774189; b=HymYVDc+5m3xjSdoQO84oSK4bxpry4fKvNpPb+NCA+oMiAbsV+0W/0wVezj5R1u1/0RbZA i9PJyAmjLxAYJ7SsF65/vaSpX2DxJyuKl/Qee8T+8+YztKiyP8xj5pGIZKRUxVWfjNbViG d28l5S1x0ieipaACYy6FWMa1zc2fJSpfb/Kf2L1Vrwz8dAuIF0yQcOY4+X6msl0jnLCQtd zzY0ntYqu/YoazJdR1x4+PVIlR0w1bgPD0B8co2Wf7Pwzf6a6zBut3NVfUDRnQ2UXXgTdY Ztc3JHUmWgEfGaDfU0i+Zqzlnn3Ql3yjZ8KFZ3tqt0Q/B4ijoGdt2bBO00909w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793774189; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/+Gl8XHZRSUds8dZ6vHfdG3KUr4Gyk0QrRchNQU56H0=; b=WcTMYjOyhzlBW7xYRaEUO8urYw+/v3/ostKK3SfwHT7kM/ZDQ8TS5ii+iq8KULXk5rP228 PkaTMOigRoX1vxXB1eFMXknYtUFwjPKbbjcx0gNpScLxVexgnBi019gcklYdzMFxM19m00 UHpY+Eyg4yBag3eKLaNkIm35YXI/I7IBXzcxPgO65/z1cRG8eGu3cBYAiiHRA+2DO13Jw+ DE0nLqxQagNnmyGSdO4bRBglKUHUc6P67+V0+oyNJZlaHA/zXXMc9Noym22y+2eRZR0oI9 By0Nfex3WfEIoNc2/1wtH417DZ7BfyvhJhCS+GqT/rBy2OHKOGO1aTgomuAtyA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jKG1T3tswzqsj for ; Wed, 04 Nov 2026 06:36:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3908d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 04 Nov 2026 06:36:24 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: bf876046e4b1 - main - linuxkpi: Fix sysfs_remove_group() for groups without a name List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bf876046e4b13c348de0414a69184026678bbf10 Auto-Submitted: auto-generated Date: Wed, 04 Nov 2026 06:36:24 +0000 Message-Id: <6aead268.3908d.5be9cc88@gitrepo.freebsd.org> The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=bf876046e4b13c348de0414a69184026678bbf10 commit bf876046e4b13c348de0414a69184026678bbf10 Author: Emmanuel Vadot AuthorDate: 2026-10-28 11:17:37 +0000 Commit: Emmanuel Vadot CommitDate: 2026-11-04 06:33:43 +0000 linuxkpi: Fix sysfs_remove_group() for groups without a name sysfs_create_group() handles a group with a NULL name by creating its attributes directly under the object node, but sysfs_remove_group() passed the NULL name to sysctl_remove_name(), which then panics in strcmp(). Mirror the creation path: for an unnamed group, remove each attribute and binary attribute individually. This was not hit before because the devres actions of a PCI device (e.g. the one registered by devm_device_add_group()) were not run when the driver was detached. Sponsored by: Beckhoff Automation Gmbh & Co. KG --- sys/compat/linuxkpi/common/include/linux/sysfs.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/sysfs.h b/sys/compat/linuxkpi/common/include/linux/sysfs.h index 4aea46d6b120..e21498c41617 100644 --- a/sys/compat/linuxkpi/common/include/linux/sysfs.h +++ b/sys/compat/linuxkpi/common/include/linux/sysfs.h @@ -403,9 +403,22 @@ sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp) static inline void sysfs_remove_group(struct kobject *kobj, const struct attribute_group *grp) { + struct attribute **attr; + struct bin_attribute **bin_attr; - if (kobj->oidp) + if (kobj->oidp == NULL) + return; + + /* Mirror sysfs_create_group(): unnamed groups live directly under kobj. */ + if (grp->name != NULL) { sysctl_remove_name(kobj->oidp, grp->name, 1, 1); + return; + } + for (attr = grp->attrs; attr != NULL && *attr != NULL; attr++) + sysctl_remove_name(kobj->oidp, (*attr)->name, 1, 1); + for (bin_attr = grp->bin_attrs; bin_attr != NULL && *bin_attr != NULL; + bin_attr++) + sysctl_remove_name(kobj->oidp, (*bin_attr)->attr.name, 1, 1); } static inline int