One GRO-cell device's NAPI callback can nest into the GRO-cell of
another device if the underlying device is also using GRO-cell.
This is the case for IPsec over vxlan.
These two GRO-cells are separate devices. From lockdep's point of view
it is the same because each device is sharing the same lock class and so
it reports a possible deadlock assuming one device is nesting into
itself.
Provide a lockclass for the bh_lock on for gro-cell device allowing
lockdep to distinguish between individual devices.
Fixes: 25718fdcbdd2 ("net: gro_cells: Use nested-BH locking for gro_cell")
Reported-by: Gal Pressman <redacted>
Closes: https://lore.kernel.org/all/66664116-edb8-48dc-ad72-d5223696dd19@nvidia.com/ (local)
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/net/gro_cells.h | 1 +
net/core/gro_cells.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/include/net/gro_cells.h b/include/net/gro_cells.h
index 596688b67a2a8..2453d0139c205 100644
--- a/include/net/gro_cells.h
+++ b/include/net/gro_cells.h
@@ -10,6 +10,7 @@ struct gro_cell;
struct gro_cells {
struct gro_cell __percpu *cells;
+ struct lock_class_key cells_bh_key;
};
int gro_cells_receive(struct gro_cells *gcells, struct sk_buff *skb);diff --git a/net/core/gro_cells.c b/net/core/gro_cells.c
index fd57b845de333..a91fdc47e8096 100644
--- a/net/core/gro_cells.c
+++ b/net/core/gro_cells.c
@@ -88,6 +88,7 @@ int gro_cells_init(struct gro_cells *gcells, struct net_device *dev)
__skb_queue_head_init(&cell->napi_skbs);
local_lock_init(&cell->bh_lock);
+ lockdep_set_class(&cell->bh_lock, &gcells->cells_bh_key);
set_bit(NAPI_STATE_NO_BUSY_POLL, &cell->napi.state);
--
2.51.0