]> git.baikalelectronics.ru Git - kernel.git/commit
netlink: add reference of module in netlink_dump_start
authorGao feng <gaofeng@cn.fujitsu.com>
Thu, 4 Oct 2012 20:15:48 +0000 (20:15 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 7 Oct 2012 04:30:56 +0000 (00:30 -0400)
commit8b5c36fe8f02241203a89e717a61ea9b9e1f38d9
tree2549dc75d29ea1975611775b05921482caf75c04
parentb8fd4bf5c3fd7243ea35d1ab16749043d902de42
netlink: add reference of module in netlink_dump_start

I get a panic when I use ss -a and rmmod inet_diag at the
same time.

It's because netlink_dump uses inet_diag_dump which belongs to module
inet_diag.

I search the codes and find many modules have the same problem.  We
need to add a reference to the module which the cb->dump belongs to.

Thanks for all help from Stephen,Jan,Eric,Steffen and Pablo.

Change From v3:
change netlink_dump_start to inline,suggestion from Pablo and
Eric.

Change From v2:
delete netlink_dump_done,and call module_put in netlink_dump
and netlink_sock_destruct.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netlink.h
net/netlink/af_netlink.c