Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Nov 2009 09:57:20 +0100
From:      Attilio Rao <attilio@freebsd.org>
To:        "Dorr H. Clark" <dclark@engr.scu.edu>
Cc:        freebsd-hackers@freebsd.org, freebsd-bugs@freebsd.org, freebsd-stable@freebsd.org
Subject:   Re: resource leak in fifo_vnops.c: 6.x/7.x/8.x
Message-ID:  <3bbf2fe10911060057t5ebfb330n486c80018826fa93@mail.gmail.com>
In-Reply-To: <Pine.GSO.4.21.0911051701520.13698-100000@nova48.dc.engr.scu.edu>
References:  <Pine.GSO.4.21.0911041504420.29358-100000@nova32.dc.engr.scu.edu> <Pine.GSO.4.21.0911051701520.13698-100000@nova48.dc.engr.scu.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
2009/11/6 Dorr H. Clark <dclark@engr.scu.edu>:
>
>
> We believe we have identified a significant resource leak
> present in 6.x, 7.x, and 8.x.  We believe this is a regression
> versus FreeBSD 4.x which appears to do the Right Thing (tm).
>
> We have a test program (see below) which will run the system
> out of sockets by repeated exercise of the failing code
> path in the kernel.
>
> Our proposed fix is applied to the file usr/src/sys/fs/fifofs/fifo_vnops.c
>
>
> @@ -237,6 +237,8 @@
>        if (ap->a_mode & FWRITE) {
>                if ((ap->a_mode & O_NONBLOCK) && fip->fi_readers == 0) {
>                        mtx_unlock(&fifo_mtx);
> +                       /* Exclusive VOP lock is held - safe to clean */
> +                       fifo_cleanup(vp);
>                        return (ENXIO);
>                }
>                fip->fi_writers++;

I think it should also check that fip->if_writers == 0 (and possibly
the checks within fifo_cleanup() should just be assertions, but that's
orthogonal someway) and the comment is not needed.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3bbf2fe10911060057t5ebfb330n486c80018826fa93>