linux/drivers/net/ethernet/mellanox/mlx4
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: 40931b8511 ("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
..
alloc.c net/mlx4: Avoid wrong virtual mappings 2016-05-05 23:23:05 -04:00
catas.c net/mlx4_core: Do not BUG_ON during reset when PCI is offline 2016-02-17 10:29:26 -05:00
cmd.c ethernet :mellanox :mlx4: Replace pci_pool_alloc by pci_pool_zalloc 2016-11-30 14:56:36 -05:00
cq.c net/mlx4_core: Set UAR page size to 4KB regardless of system page size 2016-02-17 10:29:27 -05:00
en_clock.c net/mlx4_en: Resolve dividing by zero in 32-bit system 2016-10-29 16:23:48 -04:00
en_cq.c net/mlx4_en: remove napi_hash_del() call 2016-11-17 11:17:05 -05:00
en_dcb_nl.c net/mlx4_en: Fixes for DCBX 2016-09-11 19:40:26 -07:00
en_ethtool.c mlx4: give precise rx/tx bytes/packets counters 2016-11-29 13:36:34 -05:00
en_main.c net/mlx4_en: Refactor the XDP forwarding rings scheme 2016-11-02 15:07:11 -04:00
en_netdev.c mlx4: fix use-after-free in mlx4_en_fold_software_stats() 2016-12-02 13:33:32 -05:00
en_port.c mlx4: fix use-after-free in mlx4_en_fold_software_stats() 2016-12-02 13:33:32 -05:00
en_port.h
en_resources.c net/mlx4: Avoid wrong virtual mappings 2016-05-05 23:23:05 -04:00
en_rx.c mlx4: avoid unnecessary dirtying of critical fields 2016-11-21 11:33:31 -05:00
en_selftest.c net/mlx4: Fix firmware command timeout during interrupt test 2016-10-29 16:23:48 -04:00
en_tx.c mlx4: reorganize struct mlx4_en_tx_ring 2016-11-24 16:03:37 -05:00
eq.c net/mlx4: Fix firmware command timeout during interrupt test 2016-10-29 16:23:48 -04:00
fw_qos.c
fw_qos.h
fw.c net/mlx4_core: Change the default value of enable_qos 2016-10-29 16:23:48 -04:00
fw.h mlx4: remove unused fields 2016-09-30 01:56:41 -04:00
icm.c
icm.h
intf.c net/mlx4_core: Check device state before unregistering it 2016-07-25 18:00:25 -07:00
Kconfig mlx4_en: Replace ndo_add/del_vxlan_port with ndo_add/del_udp_enc_port 2016-06-17 20:23:31 -07:00
main.c net/mlx4_core: Avoid setting ports to auto when only one port type is supported 2016-10-29 16:23:48 -04:00
Makefile
mcg.c net/mlx4: Fix some indent inconsistancy 2016-07-04 15:22:33 -07:00
mlx4_en.h mlx4: give precise rx/tx bytes/packets counters 2016-11-29 13:36:34 -05:00
mlx4_stats.h net/mlx4_en: Add ethtool statistics for XDP cases 2016-11-02 15:07:11 -04:00
mlx4.h net/mlx4_en: Fix potential deadlock in port statistics flow 2016-10-29 16:23:48 -04:00
mr.c net/mlx4: Fix some indent inconsistancy 2016-07-04 15:22:33 -07:00
pd.c io-mapping: Specify mapping size for io_mapping_map_wc() 2016-04-28 12:17:32 +01:00
port.c net/mlx4_en: Fix potential deadlock in port statistics flow 2016-10-29 16:23:48 -04:00
profile.c
qp.c net/mlx4_core: Add support for RoCE v2 entropy 2016-01-19 15:35:00 -05:00
reset.c
resource_tracker.c IB/mlx4: avoid a -Wmaybe-uninitialize warning 2016-10-29 14:53:48 -04:00
sense.c
srq.c net/mlx4_core: Use RCU to perform radix tree lookup for SRQ 2016-09-21 21:52:43 -04:00