aboutsummaryrefslogtreecommitdiff
path: root/scripts/sortextable.c
diff options
context:
space:
mode:
authordragonpt <cesar.maximo@gmail.com>2015-12-27 19:15:52 +0000
committerMoyster <oysterized@gmail.com>2016-11-11 02:40:12 +0100
commit63d84f67a7c04fab23a82d1e99d38e3bb4e5eab3 (patch)
tree49cece08354c8732b60027732c4ac4fca190569e /scripts/sortextable.c
parentd9201e2e30f4f84f98d1d8185e65442272e5fa89 (diff)
tty: Properly fix memleak of alloc_pid
Cylen Yao <cylen.yao@mediatek.com> bug: 7845126 MT67x2 Memleak is due to unreleased pid->count, which execute in function: get_pid()(pid->count++) and put_pid()(pid->count--). The race condition as following: task[dumpsys] task[adbd] in disassociate_ctty() in tty_signal_session_leader() ----------------------- ------------------------- tty = get_current_tty(); // tty is not NULL ... 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); spin_lock_irq(&p->sighand->siglock); ... p->signal->tty = NULL; ... spin_unlock_irq(&p->sighand->siglock); tty = get_current_tty(); // tty NULL, goto else branch by accident. if (tty) { ... put_pid(tty_session); put_pid(tty_pgrp); ... } else { print msg } in task[dumpsys], in disassociate_ctty(), tty is set NULL by task[adbd], tty_signal_session_leader(), then it goto else branch and lack of put_pid(), cause memleak. move spin_unlock(sighand->siglock) after get_current_tty() can avoid the race and fix the memleak.
Diffstat (limited to 'scripts/sortextable.c')
0 files changed, 0 insertions, 0 deletions