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

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's avatarJames Morse <james.morse@arm.com>
parent 13698c0c
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