Re: Semi-typical watchdog bug re early misc_register()

From: Wim Van Sebroeck
Date: Mon Mar 26 2007 - 16:30:47 EST


Hi Alexey,

> It seems that some watchdog drivers are doing following mistake:
>
> rv = misc_register();
> if (rv < 0)
> return rv;
> rv = request_region();
> if (rv < 0) {
> misc_deregister();
> return rv;
> }
>
> But, right after misc_register() returns, misc device can be opened and
> ioctls interacting with hardware issued, and driver can do outb() to
> port it doesn't own yet, because request_region() is still pending.

Totally agree. patch has been added to linux-2.6-watchdog-mm tree.

> Also, is there similar ordering between register_reboot_notifier() and
> misc_register() ? Some drivers do misc_register() last, some register
> reboot notifiers.

I prefer that the reboot notifiers are loaded before you give userspace the
ability to communicate with the driver.

Greetings,
Wim.

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