packet: avoid out of bounds read in round robin fanout
commit 468479e6 upstream. PACKET_FANOUT_LB computes f->rr_cur such that it is modulo f->num_members. It returns the old value unconditionally, but f->num_members may have changed since the last store. Ensure that the return value is always < num. When modifying the logic, simplify it further by replacing the loop with an unconditional atomic increment. Fixes: dc99f600 ("packet: Add fanout support.") Suggested-by:Eric Dumazet <edumazet@google.com> Signed-off-by:
Willem de Bruijn <willemb@google.com> Acked-by:
Eric Dumazet <edumazet@google.com> Signed-off-by:
David S. Miller <davem@davemloft.net> [lizf: Backported to 3.4: - adjust context - fanout_demux_lb() returns a pointer] Signed-off-by:
Zefan Li <lizefan@huawei.com>
Showing
Please register or sign in to comment