Skip to content

Commit 6c9e610

Browse files
author
Mamatha Inamdar
committed
powerpc/64s: Fix VAS mm use after free
JIRA: https://issues.redhat.com/browse/RHEL-133781 commit b4bda59 Author: Nicholas Piggin <npiggin@gmail.com> Date: Wed Jun 7 20:10:24 2023 +1000 powerpc/64s: Fix VAS mm use after free The refcount on mm is dropped before the coprocessor is detached. Reported-by: Sachin Sant <sachinp@linux.ibm.com> Fixes: 7bc6f71 ("powerpc/vas: Define and use common vas_window struct") Fixes: b22f2d8 ("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: Mamatha Inamdar <minamdar@redhat.com>
1 parent 1481889 commit 6c9e610

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

arch/powerpc/platforms/powernv/vas-window.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1310,8 +1310,8 @@ int vas_win_close(struct vas_window *vwin)
13101310
/* if send window, drop reference to matching receive window */
13111311
if (window->tx_win) {
13121312
if (window->user_win) {
1313-
put_vas_user_win_ref(&vwin->task_ref);
13141313
mm_context_remove_vas_window(vwin->task_ref.mm);
1314+
put_vas_user_win_ref(&vwin->task_ref);
13151315
}
13161316
put_rx_win(window->rxwin);
13171317
}

arch/powerpc/platforms/pseries/vas.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,8 @@ static int vas_deallocate_window(struct vas_window *vwin)
540540
vascaps[win->win_type].nr_open_windows--;
541541
mutex_unlock(&vas_pseries_mutex);
542542

543-
put_vas_user_win_ref(&vwin->task_ref);
544543
mm_context_remove_vas_window(vwin->task_ref.mm);
544+
put_vas_user_win_ref(&vwin->task_ref);
545545

546546
kfree(win);
547547
return 0;

0 commit comments

Comments
 (0)