lkml.org 
[lkml]   [2006]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH]: disassociate tty locking fixups
From
Date

> @@ -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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-10-14 14:23    [W:0.286 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site