Re: [PATCH] sunrpc: cache_register can use wrong module reference

From: Christoph Hellwig
Date: Tue Aug 02 2005 - 16:57:43 EST


On Tue, Aug 02, 2005 at 02:29:36PM -0700, Bruce Allan wrote:
> [resending to Neil, Trond and linux-nfs list; initial copy to lkml]
>
> When registering an RPC cache, cache_register() always sets the owner as
> the sunrpc module. However, there are RPC caches owned by other modules.
> With the incorrect owner setting, the real owning module can be removed
> potentially with an open reference to the cache from userspace.
>
> For example, if one were to stop the nfs server and unmount the nfsd
> filesystem, the nfsd module could be removed eventhough rpc.idmapd had
> references to the idtoname and nametoid caches (i.e.
> /proc/net/rpc/nfs4.<cachename>/channel is still open). This resulted in
> a system panic on one of our machines when attempting to restart the nfs
> services after reloading the nfsd module.
>
> The following patch fixes this by passing the address of the owning
> struct module to cache_register(). In addition, printk's were added to
> functions calling cache_unregister() to dump an error message on
> failure.
>
> Signed-off-by: Bruce Allan <bwa@xxxxxxxxxx>

Please put a

struct module *owner;

field into struct cache_detail instead, that's how it works for other
methods tables like that.

And while we're at it, cache_detail is an awfully generic name for a sunrpc
data structure.

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