[Bridge] [PATCH net] bridge: fix hello and hold timers starting/stopping

Xin Long lucien.xin at gmail.com
Fri May 19 17:26:35 UTC 2017


On Sat, May 20, 2017 at 12:25 AM, Ivan Vecera <cera at cera.cz> wrote:
[...]
> @@ -197,13 +191,14 @@ static void br_stp_stop(struct net_bridge *br)
>                         br_err(br, "failed to stop userspace STP (%d)\n", err);
>
>                 /* To start timers on any ports left in blocking */
> -               mod_timer(&br->hello_timer, jiffies + br->hello_time);
> -               list_for_each_entry(p, &br->port_list, list)
> -                       mod_timer(&p->hold_timer,
> -                                 round_jiffies(jiffies + BR_HOLD_TIME));
>                 spin_lock_bh(&br->lock);
>                 br_port_state_selection(br);
>                 spin_unlock_bh(&br->lock);
> +       } else {
> +               /* BR_KERNEL_STP - stop hello and hold timers */
> +               del_timer(&br->hello_timer);
> +               list_for_each_entry(p, &br->port_list, list)
> +                       del_timer(&p->hold_timer);
>         }
>
>         br->stp_enabled = BR_NO_STP;
I have a question here, br->stp_enabled is not atomic, and it is being
changed without holding br->lock here, while it may be checked in
br_hello_timer_expired, is it safe ?

(sorry if I misunderstood or overthought about it)

> --
> 2.13.0
>


More information about the Bridge mailing list