Re: [RFC PATCH] char: misc: Init misc->list in a safe way

From: Greg Kroah-Hartman
Date: Wed Jun 28 2017 - 01:18:29 EST


On Wed, Jun 28, 2017 at 09:54:32AM +0800, Orson Zhai wrote:
> We found the device is "fm". We highly suspect that fm driver call
> misc_register twice and reinitialize list to make ->pre & ->next
> pointing to himself.
>
> Meanwhile, we checked fm driver and found nothing obviously wrong in the code.

Do you have a pointer to this driver? Is it in the kernel tree?

> Consider that this is a crash after 46 hours continuous power-on/off,
> it maybe caused by some special cases we are hard to know for now.

What would cause this driver to want to register/unregister itself? Is
it "recycling" the misc structure, or creating it new each time?

And what kernel version are you testing here?

> We think it might make some sence to add protection code into
> misc_register() at first.

To protect from "foolish" callers? Usually we fix the calling code to
not do foolish things. :)

thanks,

greg k-h