Re: ppp problems in 2.5.69-bk14 - devfs related?

From: viro (viro@parcelfarce.linux.theplanet.co.uk)
Date: Wed May 28 2003 - 16:43:58 EST


On Wed, May 28, 2003 at 05:27:08PM -0400, Matthew Harrell wrote:
>
> My oops output is just marginally different under 2.5.70-bk2.
> Unfortunately, I don't seem to have a /proc/ksyms so I don't know what
> to point ksymoops to. I can make this one happen over and over by
> just running pppd. It does not kill the system but it does make it
> rather unuseable.

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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/