xdp: obtain the mem_id mutex before trying to remove an entry.
authorJonathan Lemon <jonathan.lemon@gmail.com>
Tue, 3 Dec 2019 22:01:14 +0000 (14:01 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Dec 2019 15:09:10 +0000 (16:09 +0100)
commit9bd01a33c780a4f10a2e36ecf42dcab9f6b01aa5
tree8dcbd5fb33e091a6877b6a984aeb69bf863bd656
parent05f646cb2174d1a4e032b60b99097f5c4b522616
xdp: obtain the mem_id mutex before trying to remove an entry.

[ Upstream commit 86c76c09898332143be365c702cf8d586ed4ed21 ]

A lockdep splat was observed when trying to remove an xdp memory
model from the table since the mutex was obtained when trying to
remove the entry, but not before the table walk started:

Fix the splat by obtaining the lock before starting the table walk.

Fixes: c3f812cea0d7 ("page_pool: do not release pool until inflight == 0.")
Reported-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Tested-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/core/xdp.c