]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
net/mlx4_en: use READ_ONCE when freeing xdp_prog
authorBrenden Blanco <bblanco@plumgrid.com>
Thu, 21 Jul 2016 00:22:33 +0000 (17:22 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 Jul 2016 05:07:23 +0000 (22:07 -0700)
For consistency, and in order to hint at the synchronous nature of the
xdp_prog field, use READ_ONCE in the destroy path of the ring. All
occurrences should now use either READ_ONCE or xchg.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/en_rx.c

index 11d88c817137f6753721570f8c4682c619d94091..a02dec6fb2569ebe480b368ca9a916aa0d8a53ad 100644 (file)
@@ -535,9 +535,11 @@ void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv,
 {
        struct mlx4_en_dev *mdev = priv->mdev;
        struct mlx4_en_rx_ring *ring = *pring;
+       struct bpf_prog *old_prog;
 
-       if (ring->xdp_prog)
-               bpf_prog_put(ring->xdp_prog);
+       old_prog = READ_ONCE(ring->xdp_prog);
+       if (old_prog)
+               bpf_prog_put(old_prog);
        mlx4_free_hwq_res(mdev->dev, &ring->wqres, size * stride + TXBB_SIZE);
        vfree(ring->rx_info);
        ring->rx_info = NULL;