]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
x86,fs/resctrl: Improve domain type checking
authorTony Luck <tony.luck@intel.com>
Wed, 17 Dec 2025 17:20:48 +0000 (09:20 -0800)
committerBorislav Petkov (AMD) <bp@alien8.de>
Sun, 4 Jan 2026 06:30:10 +0000 (07:30 +0100)
commit03eb578b37659e10bed14c2d9e7cc45dfe24123b
tree5e2cf51f3e10bab4dbbea7122e28209c6f3f12e1
parentf8f9c1f4d0c7a64600e2ca312dec824a0bc2f1da
x86,fs/resctrl: Improve domain type checking

Every resctrl resource has a list of domain structures. struct rdt_ctrl_domain
and struct rdt_mon_domain both begin with struct rdt_domain_hdr with
rdt_domain_hdr::type used in validity checks before accessing the domain of
a particular type.

Add the resource id to struct rdt_domain_hdr in preparation for a new monitoring
domain structure that will be associated with a new monitoring resource. Improve
existing domain validity checks with a new helper domain_header_is_valid()
that checks both domain type and resource id.  domain_header_is_valid() should
be used before every call to container_of() that accesses a domain structure.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Link: https://lore.kernel.org/20251217172121.12030-1-tony.luck@intel.com
arch/x86/kernel/cpu/resctrl/core.c
fs/resctrl/ctrlmondata.c
include/linux/resctrl.h