resource leak in fifo_vnops.c: 6.x/7.x/8.x

Attilio Rao attilio at freebsd.org
Fri Nov 6 09:19:55 UTC 2009


2009/11/6 Dorr H. Clark <dclark at 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


More information about the freebsd-bugs mailing list