• Xi Wang's avatar
    net: hns3: Fix for hns3 module is loaded multiple times problem · 3c7624d8
    Xi Wang authored
    If the hns3 driver has been built into kernel and then loaded with
    the same driver which built as KLM, it may trigger an error like
    below:
    
    [   20.009555] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
    [   20.016789] hns3: Copyright (c) 2017 Huawei Corporation.
    [   20.022100] Error: Driver 'hns3' is already registered, aborting...
    [   23.517397] Unable to handle kernel NULL pointer dereference at virtual address 00000000
    ...
    [   23.691583] Process insmod (pid: 1982, stack limit = 0x00000000cd5f21cb)
    [   23.698270] Call trace:
    [   23.700705]  __list_del_entry_valid+0x2c/0xd8
    [   23.705049]  hnae3_unregister_client+0x68/0xa8
    [   23.709487]  hns3_init_module+0x98/0x1000 [hns3]
    [   23.714093]  do_one_initcall+0x5c/0x170
    [   23.717918]  do_init_module+0x64/0x1f4
    [   23.721654]  load_module+0x1d14/0x24b0
    [   23.725390]  SyS_init_module+0x158/0x208
    [   23.729300]  el0_svc_naked+0x30/0x34
    
    This patch fixes it by adding module version info.
    
    Fixes: 38caee9d ("net: hns3: Add support of the HNAE3 framework")
    Signed-off-by: default avatarXi Wang <wangxi11@huawei.com>
    Signed-off-by: default avatarSalil Mehta <salil.mehta@huawei.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    3c7624d8
hns3_enet.c 87.7 KB