]> git.baikalelectronics.ru Git - kernel.git/commit
net: rfs: fix crash in get_rps_cpus()
authorEric Dumazet <edumazet@google.com>
Sat, 25 Apr 2015 16:35:24 +0000 (09:35 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 26 Apr 2015 20:07:57 +0000 (16:07 -0400)
commit2d7b9cabbf41d0f271f2211bbb03e0c8f03cbe3a
tree7f870304863599f718850712a8c02e51359f0897
parent6d7e2f9af398389a401f6679ebd9933da7fe4a9b
net: rfs: fix crash in get_rps_cpus()

Commit f978c8ac6945 ("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
rps_cpu_mask

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: f978c8ac6945 ("net: rfs: add hash collision detection")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Tom Herbert <tom@herbertland.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/networking/scaling.txt
net/core/dev.c