Unverified Commit 5ff9556b authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files
parents c07e067c e2944873
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -308,6 +308,18 @@ void disassociate_ctty(int on_exit)
		spin_unlock_irqrestore(&tty->ctrl_lock, flags);
		tty_unlock(tty);
		tty_kref_put(tty);

		/*
		 * Race with tty_signal_session_leader(), current->signal
		 * ->tty_old_pgrp may be reassigned, put_pid() again to ensure
		 *  the pid does not leak memory.
		 */
		if (on_exit) {
			spin_lock_irq(&current->sighand->siglock);
			put_pid(current->signal->tty_old_pgrp);
			current->signal->tty_old_pgrp = NULL;
			spin_unlock_irq(&current->sighand->siglock);
		}
	}

	/* Now clear signal->tty under the lock */