Skip to content
Commit f612aa58 authored by James Morse's avatar James Morse
Browse files

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's avatarDave Martin <dave.martin@arm.com>
Signed-off-by: James Morse's avatarJames Morse <james.morse@arm.com>
Tested-by: TANSHP's avatarShaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: Shanker Donthineni <sdonthineni@nvidia.com> # arm64
parent 3e828274
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment