• Eric Dumazet's avatar
    net: rfs: fix crash in get_rps_cpus() · a31196b0
    Eric Dumazet authored
    Commit 567e4b79 ("net: rfs: add hash collision detection") had one
    mistake :
    RPS_NO_CPU is no longer the marker for invalid cpu in set_rps_cpu()
    and get_rps_cpu(), as @next_cpu was the result of an AND with
    This bug showed up on a host with 72 cpus :
    next_cpu was 0x7f, and the code was trying to access percpu data of an
    non existent cpu.
    In a follow up patch, we might get rid of compares against nr_cpu_ids,
    if we init the tables with 0. This is silly to test for a very unlikely
    condition that exists only shortly after table initialization, as
    we got rid of rps_reset_sock_flow() and similar functions that were
    writing this RPS_NO_CPU magic value at flow dismantle : When table is
    old enough, it never contains this value anymore.
    Fixes: 567e4b79 ("net: rfs: add hash collision detection")
    Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
    Cc: Tom Herbert <tom@herbertland.com>
    Cc: Ben Hutchings <ben@decadent.org.uk>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>