Eric Dumazet 7f7bf1606f mlx4: fix use-after-free in mlx4_en_fold_software_stats()
My recent commit to get more precise rx/tx counters in ndo_get_stats64()
can lead to crashes at device dismantle, as Jesper found out.

We must prevent mlx4_en_fold_software_stats() trying to access
tx/rx rings if they are deleted.

Fix this by adding a test against priv->port_up in
mlx4_en_fold_software_stats()

Calling mlx4_en_fold_software_stats() from mlx4_en_stop_port()
allows us to eventually broadcast the latest/current counters to
rtnetlink monitors.

Fixes: 40931b85113d ("mlx4: give precise rx/tx bytes/packets counters")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-and-bisected-by: Jesper Dangaard Brouer <brouer@redhat.com>
Tested-by: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: Tariq Toukan <tariqt@mellanox.com>
Cc: Saeed Mahameed <saeedm@dev.mellanox.co.il>
Acked-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-02 13:33:32 -05:00
..
2016-11-15 22:34:25 -05:00
2016-11-16 11:10:58 -08:00
2016-11-16 20:46:32 +01:00
2016-10-21 21:40:29 +02:00
2016-09-27 12:33:47 +02:00
2016-10-07 21:23:40 -07:00
2016-11-05 10:52:29 -07:00
2016-11-16 12:39:57 -07:00
2016-10-07 21:23:40 -07:00
2016-11-11 17:02:01 -08:00
2016-09-20 20:57:12 +10:00
2016-10-06 17:03:49 -07:00
2016-10-14 11:07:42 -07:00
2016-11-01 09:04:04 -06:00
2016-10-24 19:52:24 -07:00