• Gao feng's avatar
    netlink: add reference of module in netlink_dump_start · 6dc878a8
    Gao feng authored
    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: default avatarGao feng <gaofeng@cn.fujitsu.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    6dc878a8
af_netlink.c 49.5 KB