Re: [PATCH/RFC] New module refcounting for net_proto_family

David S. Miller
2002-12-21T06:51:39Z

Bunch of problems with this patch:

1) Module leak. If try_module_get(npf->owner) works but sock_alloc()
fails, we never put the module. It just branches to the "out"
label in that case, which unlocks the net_family table and returns
err.

2) Bigger issue, why not attach the owner to struct sock
instead of socket? The sock can exist, and thus reference
the protocol family code, long after the socket (ie. the
user end) is killed off and closed.

For example, this could happen for just about any protocol family
due to stray device sk_buff references to the sock and thus the
protocol family.

Please address this stuff.