• Vadim Lomovtsev's avatar
    net: thunderx: prevent concurrent data re-writing by nicvf_set_rx_mode · 469998c8
    Vadim Lomovtsev authored
    
    
    For each network interface linux network stack issue ndo_set_rx_mode call
    in order to configure MAC address filters (e.g. for multicast filtering).
    Currently ThunderX NICVF driver has only one ordered workqueue to process
    such requests for all VFs.
    
    And because of that it is possible that subsequent call to
    ndo_set_rx_mode would corrupt data which is currently in use
    by nicvf_set_rx_mode_task. Which in turn could cause following issue:
    [...]
    [   48.978341] Unable to handle kernel paging request at virtual address 1fffff0000000000
    [   48.986275] Mem abort info:
    [   48.989058]   Exception class = DABT (current EL), IL = 32 bits
    [   48.994965]   SET = 0, FnV = 0
    [   48.998020]   EA = 0, S1PTW = 0
    [   49.001152] Data abort info:
    [   49.004022]   ISV = 0, ISS = 0x00000004
    [   49.007869]   CM = 0, WnR = 0
    [   49.010826] [1fffff0000000000] address between user and kernel address ranges
    [   49.017963] Internal error: Oops: 96000004 [#1] SMP
    [...]
    [   49.072138] task: ffff800fdd675400 task.stack: ffff000026440000
    [   49.078051] PC is at prefetch_freepointer.isra.37+0x28/0x3c
    [   49.083613] LR is at kmem_cache_alloc_trace+0xc8/0x1fc
    [...]
    [   49.272684] [<ffff0000082738f0>] prefetch_freepointer.isra.37+0x28/0x3c
    [   49.279286] [<ffff000008276bc8>] kmem_cache_alloc_trace+0xc8/0x1fc
    [   49.285455] [<ffff0000082c0c0c>] alloc_fdtable+0x78/0x134
    [   49.290841] [<ffff0000082c15c0>] dup_fd+0x254/0x2f4
    [   49.295709] [<ffff0000080d1954>] copy_process.isra.38.part.39+0x64c/0x1168
    [   49.302572] [<ffff0000080d264c>] _do_fork+0xfc/0x3b0
    [   49.307524] [<ffff0000080d29e8>] SyS_clone+0x44/0x50
    [...]
    
    This patch is to prevent such concurrent data write with spinlock.
    Reported-by: default avatarDean Nelson <dnelson@redhat.com>
    Signed-off-by: default avatarVadim Lomovtsev <Vadim.Lomovtsev@cavium.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    469998c8
nicvf_main.c 57.3 KB