> @@ -1364,14 +1366,16 @@ static void do_tty_hangup(void *data)
> p->signal->tty = NULL;
> if (!p->signal->leader)
> continue;
> + mutex_unlock(&tty_mutex);
> group_send_sig_info(SIGHUP, SEND_SIG_PRIV, p);
> group_send_sig_info(SIGCONT, SEND_SIG_PRIV, p);
> + mutex_lock(&tty_mutex);
> if (tty->pgrp > 0)
> p->signal->tty_old_pgrp = tty->pgrp;
> } while_each_task_pid(tty->session, PIDTYPE_SID, p);
> }
> read_unlock(&tasklist_lock);
> -
> + mutex_unlock(&tty_mutex);
Hi,
what is the lock ordering rules between tasklist_lock and tty_mutex?
In the code above you first take tty_mutex then tasklist_lock, and later
on you drop tty_mutex, with the result that you then have a
tasklist_lock -> tty_mutex order.
This can deadlock if someone gets in the middle with a
mutex_lock(&tty_mutex);
write_lock(&tasklist_lock);
....
in addition, are you sure you don't need to revalidate anything after
retaking the lock?
Greetings,
Arjan van de Ven
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]