Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796084807; b=f81ofvV+SsHUmKeXodQ6OMEyJmBipEdHUMOwqi4oX8IiOJWp8b5jayk9hUx2JHqXAkuB /vBUFKXPASmeE2dKSF+/cm/pCWtxdBV30AQxnGXZWN6AfgLzie8SHmm/CubwSgHybPex8 qtQTny1ty/Om3RGfU3T5OoMT2GQWqWAtTWOclCgHtaICH4Uz2zaevlJj5ArDWjdUI3SXU 9ArJL+NCi1u9wBF98HonP+VUxKyR3oyZ2h5spKI/AH6F6cWGzdc6SZf4rDFCnEPCu1wEI dcCialRYxNlsiBJg7QA6Mdz0s88rzW9Zw4QKIeyp43hJze4MCcaKY7ViIvnEqOE/mSA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796084807; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=9zjUWzmTmuVw3LhEnQ0u5I+zGQUfcYN7DrSJlS0Gpng=; b=SHBaUT/HWbiHbEmB+5z4ayyoW2/lDGDghR5Z8izoD1Yj6x0fEpF7kNww1WJSmuNtDrYA R0WozfdH+TuqlqzY7OexKsNU4U6vBGdRvLzZ8O2D4ln1J/U4G7+XBrq+yNcO/tDX7U0FN AJdLo7wasSjIWm0NhE5mTdDTUoo5sEZuoqIV3aLSg+Bo+CfiS++bj3RNyo4bEAQD/02sA VtMcw84zlURh94H85obb6X4gldXQloWItvUX0R55Ej8x3YYcCQlU9aqgFvlV1lmjEQmJc m74GVbQjyQrv10RPOrGQYPPpI2rMrJ1LAEU0S10ap7Onxf8UyDILl3WYWAIEcVCCEfA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b="l/G51uNF"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B115606A31A; Tue, 1 Dec 2026 00:26:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=l/G51uNF Received: by smtp.kernel.org (Postfix) with ESMTPSA id C674E1F00897; Tue, 1 Dec 2026 00:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796084806; bh=9zjUWzmTmuVw3LhEnQ0u5I+zGQUfcYN7DrSJlS0Gpng=; h=Date:To:From:In-Reply-To:References:Subject; b=l/G51uNFeFILZ7qCjUurETSTdbLhA1cxHe8evuxKGnI957bcNUfIaYTTkBR9HHUNg VtzFXwNNeX/4uNf1QV+UfK8owY6V4gZBxYOtUBWrhmVduhF4aP0vgUBne/E8G1FI4Y +XzUX+REo/rDI19udknnXPVtRDugYS8rLJc092J0= Date: Mon, 30 Nov 2026 16:26:46 -0800 To: mm-commits@vger.kernel.org,stable@vger.kernel.org,sj@kernel.org, set_pte_at@outlook.com,lienze@kylinos.cn,lianux.mm@gmail.com, jm5905938@gmail.com,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261130150729.88226-1-sj@kernel.org> References: <20261130150729.88226-1-sj@kernel.org> Subject: + mm-damon-sysfs-skip-registration-if-damon-core-init-fails.patch added to mm-hotfixes-unstable branch Message-Id: <20261201002646.C674E1F00897@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: mm/damon/sysfs: skip registration if DAMON core init fails has been added to the -mm mm-hotfixes-unstable branch. Its filename is mm-damon-sysfs-skip-registration-if-damon-core-init-fails.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-damon-sysfs-skip-registration-if-damon-core-init-fails.patch This patch will later appear in the mm-hotfixes-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Aveline Noir Subject: mm/damon/sysfs: skip registration if DAMON core init fails Date: Mon, 30 Nov 2026 07:07:28 -0800 DAMON sysfs registers its interface even if DAMON core initialization fails. If damon_init() fails to allocate damon_region_cache, starting a kdamond with an initial region can pass a NULL cache to kmem_cache_alloc() via damon_new_region(). As a result, NULL dereference can happen. The initialization failure is unlikely, but the consequence is quite bad. Check damon_initialized() before creating the DAMON sysfs directory and return -ENOMEM if the core is unavailable. Link: https://patch.msgid.link/20261130150729.88226-1-sj@kernel.org Fixes: a18709442869 ("mm/damon: improve damon_new_region strategy") Signed-off-by: Aveline Noir Signed-off-by: SJ Park Signed-off-by: Andrew Morton Reviewed-by: SJ Park Tested-by: Enze Li Reviewed-by: Enze Li Cc: Lian Wang Cc: Dawei Li Cc: # 6.1.x mm/damon/sysfs.c | 3 +++ 1 file changed, 3 insertions(+) --- a/mm/damon/sysfs.c~mm-damon-sysfs-skip-registration-if-damon-core-init-fails +++ a/mm/damon/sysfs.c @@ -3031,6 +3031,9 @@ static int __init damon_sysfs_init(void) struct damon_sysfs_ui_dir *admin; int err; + if (!damon_initialized()) + return -ENOMEM; + damon_sysfs_root = kobject_create_and_add("damon", mm_kobj); if (!damon_sysfs_root) return -ENOMEM; _ Patches currently in -mm which might be from jm5905938@gmail.com are mm-hmm-account-for-subpage-offsets-in-device-private-pmds.patch mm-damon-sysfs-skip-registration-if-damon-core-init-fails.patch mm-damon-ops-common-align-mmu-notifier-range-when-clearing-pmd-young-bit.patch mm-damon-stat-avoid-32-bit-overflow-in-idle-percentiles.patch mm-damon-pvaddr-skip-folios-already-on-the-migration-target-node.patch docs-admin-guide-mm-damon-start-fix-grammar.patch docs-admin-guide-mm-damon-stat-fix-pronoun-agreement.patch docs-admin-guide-mm-damon-usage-fix-grammar.patch docs-admin-guide-mm-damon-lru_sort-fix-remaining-grammar.patch docs-mm-damon-design-fix-grammar-and-typos.patch docs-mm-damon-api-fix-verb-form.patch docs-mm-damon-maintainer-profile-fix-subject-verb-agreement.patch docs-mm-damon-monitoring_intervals_tuning_example-fix-grammar-and-typos.patch mm-damon-paddr-add-kunit-tests-for-addr_unit-conversion.patch mm-damon-paddr-add-kunit-tests-for-addr_unit-conversion-fix.patch mm-damon-paddr-skip-non-lru-folios-as-a-whole-in-pageout.patch mm-damon-core-skip-apply_probes-when-no-probes-are-installed.patch selftests-damon-damos_quota-skip-the-last-sample-when-counting-exceeds.patch