Fix refcount leak in tty_port.c
A message that is not in the archive (sent off-list or not yet received): 20130709083535.GA30227
Hello,
I'm sorry to bother you again, I'm just pinging to see if you received the patch or if it got lost in the noise. It fixes a regression introduced in git commit aa27a094e2c2e
I have another patch for rfcomm tty waiting for this fix to get applied.
Thank you,
Gianluca
Quoted 35 lines · Gianluca Anzolin
Hello,
In linux 3.10 in the file
drivers/tty/tty_port.cthe functiontty_port_tty_hangupmay leak a tty reference:struct tty_struct *tty = tty_port_tty_get(port); if (tty && (!check_clocal || !C_CLOCAL(tty))) { tty_hangup(tty); tty_kref_put(tty); }If tty != NULL and the second condition is false we never call
tty_kref_putand the reference is leaked.Fix by nesting two if statements.
Signed-off-by Gianluca Anzolin <[email protected]>drivers/tty/tty_port.c +3
-2@@ -256,8 +256,9 @@ void tty_port_tty_hangup(struct tty_port *port, bool check_clocal) {struct tty_struct *tty =tty_port_tty_get (port); -if (tty && (!check_clocal || !C_CLOCAL (tty))) { -tty_hangup (tty); +if (tty) { +if (!check_clocal || !C_CLOCAL (tty)) +tty_hangup (tty);tty_kref_put (tty); } }
Quoted 7 lines · Gianluca Anzolin
Hello,
I'm sorry to bother you again, I'm just pinging to see if you received the patch or if it got lost in the noise. It fixes a regression introduced in git commit
aa27a094e2c2eI have another patch for rfcomm tty waiting for this fix to get applied.
I have it, just waiting for 3.11-rc1 to come out before dealing with any new patches.
thanks,
greg k-h