]> git.baikalelectronics.ru Git - kernel.git/commit
[NETLINK]: Fix module refcounting problems
authorPatrick McHardy <kaber@trash.net>
Mon, 15 Aug 2005 02:27:13 +0000 (19:27 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 29 Aug 2005 23:00:45 +0000 (16:00 -0700)
commitfe605faa1013ef3837741d86074b903fd40944e6
treef6129e1aa25be790fdf38d5f39e1d38b2fa19587
parent5fe34ef9cd8215c441eaea9caef8287d5aae9803
[NETLINK]: Fix module refcounting problems

Use-after-free: the struct proto_ops containing the module pointer
is freed when a socket with pid=0 is released, which besides for kernel
sockets is true for all unbound sockets.

Module refcount leak: when the kernel socket is closed before all user
sockets have been closed the proto_ops struct for this family is
replaced by the generic one and the module refcount can't be dropped.

The second problem can't be solved cleanly using module refcounting in the
generic socket code, so this patch adds explicit refcounting to
netlink_create/netlink_release.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netlink/af_netlink.c