fs/resctrl: Avoid a race with dom_data_exit() and rmid_ptrs[]
On MPAM systems if an error occurs the arhictecture code will call
resctrl_exit(). This calls dom_data_exit() which takes the
rdrgroup_mutex and kfree()s rmid_ptrs[].
It is possible that another syscall tries to access that same array in
the meantime, but is blocked on the mutex. Once dom_data_exit()
completes, that syscall will see a NULL pointer.
Make __rmid_entry() return NULL in this case. Neither __check_limbo()
nor free_rmid() return an error, and can silently stop their work
if this occurs. dom_data_init() has only just allocated the array and
still holds the lock, so __rmid_entry() should never return NULL here.
Signed-off-by:
James Morse <james.morse@arm.com>
Loading
Please register or sign in to comment