tty: Fix race between tty release and echo_delayed_work
Fix potential race between tty release and echo_delayed_work, which could result in use after free scenario for tty struct. Change-Id: I1ea0f2a17d1131c686b3fe387a3576f3d037a3a5 Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
parent
01dafb7621
commit
fda51f09a7
@@ -1460,6 +1460,10 @@ static void release_one_tty(struct work_struct *work)
|
|||||||
|
|
||||||
put_pid(tty->pgrp);
|
put_pid(tty->pgrp);
|
||||||
put_pid(tty->session);
|
put_pid(tty->session);
|
||||||
|
#if defined(CONFIG_TTY_FLUSH_LOCAL_ECHO)
|
||||||
|
if (tty->echo_delayed_work.work.func)
|
||||||
|
cancel_delayed_work_sync(&tty->echo_delayed_work);
|
||||||
|
#endif
|
||||||
free_tty_struct(tty);
|
free_tty_struct(tty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user