From: Brenden Blanco <bbla...@plumgrid.com>
Date: Tue, 12 Jul 2016 00:51:29 -0700

> +     mlx4_en_free_resources(priv);
> +
>       old_prog = xchg(&priv->prog, prog);
>       if (old_prog)
>               bpf_prog_put(old_prog);
>  
> -     return 0;
> +     err = mlx4_en_alloc_resources(priv);
> +     if (err) {
> +             en_err(priv, "Failed reallocating port resources\n");
> +             goto out;
> +     }
> +     if (port_up) {
> +             err = mlx4_en_start_port(dev);
> +             if (err)
> +                     en_err(priv, "Failed starting port\n");

A failed configuration operation should _NEVER_ leave the interface in
an inoperative state like these error paths do.

You must instead preallocate the necessary resources, and only change
the chip's configuration and commit to the new settings once you have
successfully allocated those resources.

Reply via email to