powerpc/64s: Fix VAS mm use after free
[ Upstream commitb4bda59b47
] The refcount on mm is dropped before the coprocessor is detached. Reported-by: Sachin Sant <sachinp@linux.ibm.com> Fixes:7bc6f71bdf
("powerpc/vas: Define and use common vas_window struct") Fixes:b22f2d88e4
("powerpc/pseries/vas: Integrate API with open/close windows") Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Tested-by: Sachin Sant <sachinp@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20230607101024.14559-1-npiggin@gmail.com Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
75d65c1cc4
commit
4e82f92c34
|
@ -1310,8 +1310,8 @@ int vas_win_close(struct vas_window *vwin)
|
|||
/* if send window, drop reference to matching receive window */
|
||||
if (window->tx_win) {
|
||||
if (window->user_win) {
|
||||
put_vas_user_win_ref(&vwin->task_ref);
|
||||
mm_context_remove_vas_window(vwin->task_ref.mm);
|
||||
put_vas_user_win_ref(&vwin->task_ref);
|
||||
}
|
||||
put_rx_win(window->rxwin);
|
||||
}
|
||||
|
|
|
@ -507,8 +507,8 @@ static int vas_deallocate_window(struct vas_window *vwin)
|
|||
vascaps[win->win_type].nr_open_windows--;
|
||||
mutex_unlock(&vas_pseries_mutex);
|
||||
|
||||
put_vas_user_win_ref(&vwin->task_ref);
|
||||
mm_context_remove_vas_window(vwin->task_ref.mm);
|
||||
put_vas_user_win_ref(&vwin->task_ref);
|
||||
|
||||
kfree(win);
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue