Re: 2.6.25.11-97.fc9 (P): idr_remove called for id=236 which is not allocated

From: Vegard Nossum
Date: Fri Aug 15 2008 - 17:26:42 EST


On Fri, Aug 15, 2008 at 5:28 PM, Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> wrote:
>> ida_remove called for id=112 which is not allocated.
>> ida_remove called for id=67 which is not allocated.
>> ida_remove called for id=191 which is not allocated.
>> ida_remove called for id=23 which is not allocated.
>>
>> ..and with no backtrace, so I guess it means "not harmful". Sorry for the noise.
>
> Thats definitely not good and wants digging into further.

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
--
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/