xdp: Fix cleanup on map free for devmap_hash map type
authorToke Høiland-Jørgensen <toke@redhat.com>
Thu, 21 Nov 2019 13:36:12 +0000 (14:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 26 Jan 2020 09:01:08 +0000 (10:01 +0100)
commit074fd02d45976eed02f82cb2d9e01b0169cc1ec5
tree34ce76d70a6812178210b7183a47eaaa7a080bb4
parent62ac16b0deeffff42501cface181a652a9004f26
xdp: Fix cleanup on map free for devmap_hash map type

[ Upstream commit 071cdecec57fb5d5df78e6a12114ad7bccea5b0e ]

Tetsuo pointed out that it was not only the device unregister hook that was
broken for devmap_hash types, it was also cleanup on map free. So better
fix this as well.

While we're at it, there's no reason to allocate the netdev_map array for
DEVMAP_HASH, so skip that and adjust the cost accordingly.

Fixes: 6f9d451ab1a3 ("xdp: Add devmap_hash map type for looking up devices by hashed index")
Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20191121133612.430414-1-toke@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/bpf/devmap.c