Re: [KJ][PATCH] Correct misc_register return code handling in several drivers

From: Neil Horman
Date: Thu Nov 02 2006 - 09:22:55 EST


On Wed, Nov 01, 2006 at 03:55:41PM -0800, Andrew Morton wrote:
> On Wed, 1 Nov 2006 08:56:19 -0500
> Neil Horman <nhorman@xxxxxxxxxxxxx> wrote:
>
> > Since Andrew hasn't incorporated this patch yet, and I had the time, I
> > redid the patch taking Benjamin's INIT_LIST_HEAD and Joes mmtimer cleanup into
> > account. New patch attached, replacing the old one, everything except the
> > aforementioned cleanups is identical.
>
> Please prepare a description for this patch. The INIT_LIST_HEAD() in
> misc_register() is mysterious.

Andrew-
This is a patch to clean up several code points in which the return code
from misc_register is not handled properly. Several modules failed to
deregister various hooks when misc_register fails, and this patch cleans them
up. Also there are a few modules that legitimately don't care about the failure
status of misc register. These drivers however unilaterally call
misc_deregister on module unload. Since misc_register doesn't initialize the
list_head in the init_routine if it fails, the deregister operation is at risk
for oopsing when list_del is called. The initial solution was to manually init
the list in the miscdev structure in each of those modules, but the consensus in
this thread was to consolodate and do that universally inside misc_register.

Thanks & Regards
Neil

--
/***************************************************
*Neil Horman
*Software Engineer
*gpg keyid: 1024D / 0x92A74FA1 - http://pgp.mit.edu
***************************************************/
-
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/