Fsck knows why devfs_mk_cdev() fails, but what follows that is obvious -
int __init ppp_init(void)
{
int err;
printk(KERN_INFO "PPP generic driver version " PPP_VERSION "\n");
err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops);
if (!err) {
err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0),
S_IFCHR|S_IRUSR|S_IWUSR, "ppp");
}
if (err)
printk(KERN_ERR "failed to register PPP device (%d)\n", err);
return err;
}
clearly leaves device registered after failed insmod. open() afterwards
happily finds the device and dies on attempt to do anything with it
(the module is not there, pointers go to hell knows where).
I'd suggest to change that to
err = devfs_mk_cdev(...)
if (!err) {
err = register_chrdev(...)
if (!err)
return 0;
devfs_remove(...)
}
printk(...)
return err;
That will _not_ solve the devfs problem, whatever it is, but it will make sure
that any errors are handled correctly.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/