Re: [patch 0/4] Cleanup file_count usage

From: Paul Mackerras
Date: Tue Nov 16 2004 - 17:32:47 EST


Ravikiran G Thirumalai writes:

> 2. Read to f_count at drivers/net/ppp_generic.c:
> The PPPIOCDETACH ioctl is failed if the device fd is duped and
> being polled by another process -- which is determined by a read
> to f_count. The comments in the code indicate that the PPPIOCDETACH
> ioctl should be junked and userland can use a workaround
> by closing the fd and reopening /dev/ppp. I can make a patch to junk
> PPPIOCDETACH, but is it okay to break binary compatibility? Paul?

I would very much rather not break binary compatibility. People using
ppp-2.4.2 or ppp-2.4.3 won't be affected by this change, but ppp-2.4.2
was released in January this year and I wouldn't be surprised if
some people are still using ppp-2.4.1 (or even ppp-2.4.0), which would
be affected.

I suggest that as a temporary compromise, we keep PPPIOCDETACH but
make it zero file->private_data without freeing the ppp structure that
it points to. That will cause a memory leak but will avoid the
possibility of using that memory after it is freed (in the case where
the descriptor has been dup'd and another process is doing a poll on
it).

We should make the kernel whinge loudly when anyone uses PPPIOCDETACH,
too. If/when 2.7.0 comes along we can remove it.

Paul.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/