lkml.org 
[lkml]   [2007]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Serial buffer memory leak
Laurent Pinchart wrote:
> Patch c5c34d4862e18ef07c1276d233507f540fb5a532 (tty: flush flip buffer on
> ldisc input queue flush) introduces a race condition which can lead to memory
> leaks.
>
> The problem can be triggered when tcflush() is called when data are being
> pushed to the line discipline driver by flush_to_ldisc().
>
> flush_to_ldisc() releases tty->buf.lock when calling the line discipline
> receive_buf function. At that poing tty_buffer_flush() kicks in and sets both
> tty->buf.head and tty->buf.tail to NULL. When flush_to_ldisc() finishes, it
> restores tty->buf.head but doesn't touch tty->buf.tail. This corrups the
> buffer queue, and the next call to tty_buffer_request_room() will allocate a
> new buffer and overwrite tty->buf.head. The previous buffer is then lost
> forever without being released.

Your description is clear enough, I'll make the patch.

Thanks,
Paul
-
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: 2007-08-08 15:19    [W:0.052 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site