fs/resctrl: Don't touch rmid_ptrs[] in free_rmid() when there are no monitors
On platforms with no monitors the rmid_ptrs[] array is not allocated. The rmid on these platforms is likely to be '0' for all control groups, which may lead to free_rmid() being called on rmid 0. Dave points out that the index == (0,0) check to skip freeing of a non-existant rmid is not sufficient on MPAM because the provided closid may be non-zero. The index can't be used to spot this case. Instead, check if there are any resctrl monitors enabled. This avoids a null pointer dereference in free_rmid() when control groups are freed. It isn't possible to hit this on x86 platforms. This patch to be replaced by one from Dave. Reported-by:Dave Martin <dave.martin@arm.com> Signed-off-by:
James Morse <james.morse@arm.com> Tested-by:
Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> Tested-by: Shanker Donthineni <sdonthineni@nvidia.com> # arm64
Loading
Please register or sign in to comment