mdev accidently erases previously created nodes while trying to rename nodes

Jean Wolter jw5 at os.inf.tu-dresden.de
Wed Jun 17 13:52:12 UTC 2009


Hello,

while using mdev to create device nodes for the capi subsystem mdev
accidently deletes a previously created node. Assume the following
lines in mdev.conf:

capi            0:0 0660 =capi20
capi([0-9])     0:0 0660 =capi20.0%1
capi([0-9]*)    0:0 0660 =capi20.%1

After loading the capi module the kernel generate a number of hotplug
events, starting with capi, followed by capi0-capi32. mdev creates
/dev/capi, and renames it to /dev/capi20. 

When the event  "add tty /class/tty/capi0" comes in, mdev executes

    unlink /dev/capi20
    mknod /dev/capi20
    rename(/dev/capi20,/dev/capi20.20)
 
and erases the original /dev/capi20 device while doing this.

So to me it looks like mdev should try to do the renaming before
actually creating the device node (or deleting it for a remove hotplug
event). The attached patch against git (head?) tries to fix this. It
is adapted from a patch against 1.14.1 and did not get much testing so
far.

regards,
Jean



More information about the busybox mailing list