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

Commit 9dfbba8b authored by Murali Nalajala's avatar Murali Nalajala
Browse files

tty: cancel delayed work before ldisc and disc_data become NULL



tty->ldisc and tty->disc_data become NULL before worker get
schedule to process the flushing echo buffer with small delays.
This leads to a mem abort is being observed in work item
continue_process_echoes(). Fix cancelling the work item before
tty->ldisc and tty->disc_data become NULL.

tty_release()
  tty_release_struct()
    tty_ldisc_release()
        tty_ldisc_kill()  // here tty->ldisc and tty->disc_data became NULL
    release_tty()
      tty_kref_put()
        kref_put(&tty->kref, queue_release_one_tty)

Change-Id: I168d6c93d011a8d419a397321a948de44f0ec749
Signed-off-by: default avatarMurali Nalajala <mnalajal@codeaurora.org>
parent edcd9db1
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -617,6 +617,12 @@ static void tty_ldisc_kill(struct tty_struct *tty)
{
	if (!tty->ldisc)
		return;

#if defined(CONFIG_TTY_FLUSH_LOCAL_ECHO)
	if (tty->echo_delayed_work.work.func)
		cancel_delayed_work_sync(&tty->echo_delayed_work);
#endif

	/*
	 * Now kill off the ldisc
	 */