Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dab446f3 authored by Neeraj Upadhyay's avatar Neeraj Upadhyay Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarNeeraj Upadhyay <neeraju@codeaurora.org>
parent eced530e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1663,6 +1663,10 @@ static void release_one_tty(struct work_struct *work)

	put_pid(tty->pgrp);
	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);
}