Re: Serial buffer memory leak

2007-08-08 Thread Paul Fulghum
On Wed, 2007-08-08 at 16:32 +0100, Alan Cox wrote: > Ok try this for size folks. Use tty->flags bits for the flush status. > Wait for the flag to clear again before returning > Fix the doc error noted > Fix flush of empty queue leaving stale flushpending > > > Signed-off-by: Alan Cox <[EMAIL PRO

Re: Serial buffer memory leak

2007-08-08 Thread Alan Cox
On Wed, 8 Aug 2007 16:16:06 +0100 Alan Cox <[EMAIL PROTECTED]> wrote: > > tty_buffer_flush() needs to wait for buf.flushpending to clear. > Should probably make the flushpending an atomic bit op to avoid taking > and retaking the lock. Ok try this for size folks. Use tty->flags bits for the flus

Re: Serial buffer memory leak

2007-08-08 Thread Alan Cox
> tty_buffer_flush() needs to wait for buf.flushpending to clear. Not 100% sure it does as its no different to events really occuring with a possible timing. Trivial to wait_event on the read queue for this however and definitely worth doing to be sure. Should probably make the flushpending an at

Re: Serial buffer memory leak

2007-08-08 Thread Paul Fulghum
On Wed, 2007-08-08 at 16:28 +0200, Laurent Pinchart wrote: > The patch fixes the problem (at least under the test conditions that lead me > to discover it in the first place). Thanks Alan. It works here also, but I see a problem. By deferring the flush, ioctl(TCFLSH) returns immediately even th

Re: Serial buffer memory leak

2007-08-08 Thread Frederik Deweerdt
On Wed, Aug 08, 2007 at 02:45:32PM +0100, Alan Cox wrote: > > I'm not familiar enough with the tty code to decide what the proper fix > > should > > be. I'll try to write a patch if someone could point me in the right > > direction. > > Something like this perhaps ? > [] > - * flush all

Re: Serial buffer memory leak

2007-08-08 Thread Laurent Pinchart
On Wednesday 08 August 2007 16:11, Paul Fulghum wrote: > On Wed, 2007-08-08 at 14:45 +0100, Alan Cox wrote: > > > I'm not familiar enough with the tty code to decide what the proper fix > > > should be. I'll try to write a patch if someone could point me in the > > > right direction. > > > > Someth

Re: Serial buffer memory leak

2007-08-08 Thread Paul Fulghum
On Wed, 2007-08-08 at 14:45 +0100, Alan Cox wrote: > > I'm not familiar enough with the tty code to decide what the proper fix > > should > > be. I'll try to write a patch if someone could point me in the right > > direction. > > Something like this perhaps ? That looks good, a little better t

Re: Serial buffer memory leak

2007-08-08 Thread Alan Cox
> I'm not familiar enough with the tty code to decide what the proper fix > should > be. I'll try to write a patch if someone could point me in the right > direction. Something like this perhaps ? diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.23rc1-mm1/drive

Re: Serial buffer memory leak

2007-08-08 Thread Paul Fulghum
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

Serial buffer memory leak

2007-08-08 Thread Laurent Pinchart
Hi everybody. 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_t