On Fri, Aug 15, 2008 at 5:28 PM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
Hi,
I've now been digging. This reproduces it accurately:
# mknod fubar c 128 42
# cat fubar
<ctrl-c>
idr_remove called for id=42 which is not allocated.
Major nr. 128 is UNIX98_PTY_MASTER_MAJOR. The
Documentation/devices.txt tells us to access these through /dev/ptmx
only. So when we don't follow that rule, tty_open() is called instead
of ptmx_open() when the device is opened. ptmx_open() would allocate a
new id to use. But since we call tty_open(), it will use tty->index
which is set from get_tty_driver() -- calculated using the minor
number that we provided!
The only thing I don't understand is why we don't get _two_ errors on
close() -- I would expect to get one for the slave too. But maybe the
slave is never created. What do you think of this theory?
Vegard
--
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
-- E. W. Dijkstra, EWD1036
--