Re: module: fix module_refcount() return when running in a module exit routine

From: Christoph Hellwig
Date: Fri Jan 23 2015 - 08:18:11 EST


On Fri, Jan 23, 2015 at 01:24:15PM +1030, Rusty Russell wrote:
> The correct fix is to turn try_module_get() into __module_get(), and
> always do the module_put().

Is this really safe? __module_get sais it needs a non-zero refcount
to start with, but scsi_device_get is the only thing every incrementing
the refcount on the module pointer in the scsi host template, so
exactly that case can happen easily. There's not assert actually
hardcoding the assumption, so I'm not sure if requirement the comment
really just is nice to have or a strong requirement.
--
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/