Skip to content

Commit

Permalink
net: bridge: mcast: Associate the seqcount with its protecting lock.
Browse files Browse the repository at this point in the history
The sequence count bridge_mcast_querier::seq is protected by
net_bridge::multicast_lock but seqcount_init() does not associate the
seqcount with the lock. This leads to a warning on PREEMPT_RT because
preemption is still enabled.

Let seqcount_init() associate the seqcount with lock that protects the
write section. Remove lockdep_assert_held_once() because lockdep already checks
whether the associated lock is held.

Fixes: 67b746f ("net: bridge: mcast: make sure querier port/address updates are consistent")
Reported-by: Mike Galbraith <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
Tested-by: Mike Galbraith <[email protected]>
Acked-by: Nikolay Aleksandrov <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
KAGA-KOKO authored and kuba-moo committed Sep 29, 2021
1 parent 9e28cfe commit f936bb4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions net/bridge/br_multicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -1677,8 +1677,6 @@ static void br_multicast_update_querier(struct net_bridge_mcast *brmctx,
int ifindex,
struct br_ip *saddr)
{
lockdep_assert_held_once(&brmctx->br->multicast_lock);

write_seqcount_begin(&querier->seq);
querier->port_ifidx = ifindex;
memcpy(&querier->addr, saddr, sizeof(*saddr));
Expand Down Expand Up @@ -3867,13 +3865,13 @@ void br_multicast_ctx_init(struct net_bridge *br,

brmctx->ip4_other_query.delay_time = 0;
brmctx->ip4_querier.port_ifidx = 0;
seqcount_init(&brmctx->ip4_querier.seq);
seqcount_spinlock_init(&brmctx->ip4_querier.seq, &br->multicast_lock);
brmctx->multicast_igmp_version = 2;
#if IS_ENABLED(CONFIG_IPV6)
brmctx->multicast_mld_version = 1;
brmctx->ip6_other_query.delay_time = 0;
brmctx->ip6_querier.port_ifidx = 0;
seqcount_init(&brmctx->ip6_querier.seq);
seqcount_spinlock_init(&brmctx->ip6_querier.seq, &br->multicast_lock);
#endif

timer_setup(&brmctx->ip4_mc_router_timer,
Expand Down
2 changes: 1 addition & 1 deletion net/bridge/br_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct bridge_mcast_other_query {
struct bridge_mcast_querier {
struct br_ip addr;
int port_ifidx;
seqcount_t seq;
seqcount_spinlock_t seq;
};

/* IGMP/MLD statistics */
Expand Down

0 comments on commit f936bb4

Please sign in to comment.