netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] qlnic: fix a race in qlcnic_get_stats()
@ 2010-08-18 10:42 Eric Dumazet
  2010-08-18 10:47 ` Amit Salecha
  2010-08-19  7:44 ` [PATCH] qlnic: fix a race in qlcnic_get_stats() David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Dumazet @ 2010-08-18 10:42 UTC (permalink / raw)
  To: David Miller; +Cc: Amit Kumar Salecha, netdev

Dont clear netdev->stats, it might give transient wrong values to
concurrent stat readers.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 drivers/net/qlcnic/qlcnic_main.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index abd7cd6..d71d44a 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -1980,8 +1980,6 @@ static struct net_device_stats *qlcnic_get_stats(struct net_device *netdev)
 	struct qlcnic_adapter *adapter = netdev_priv(netdev);
 	struct net_device_stats *stats = &netdev->stats;
 
-	memset(stats, 0, sizeof(*stats));
-
 	stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts;
 	stats->tx_packets = adapter->stats.xmitfinished;
 	stats->rx_bytes = adapter->stats.rxbytes + adapter->stats.lrobytes;



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [PATCH] qlnic: fix a race in qlcnic_get_stats()
  2010-08-18 10:42 [PATCH] qlnic: fix a race in qlcnic_get_stats() Eric Dumazet
@ 2010-08-18 10:47 ` Amit Salecha
  2010-08-18 12:29   ` [PATCH] netxen: fix a race in netxen_nic_get_stats() Eric Dumazet
  2010-08-19  7:44 ` [PATCH] qlnic: fix a race in qlcnic_get_stats() David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Amit Salecha @ 2010-08-18 10:47 UTC (permalink / raw)
  To: Eric Dumazet, David Miller; +Cc: netdev

Same fix will be require for netxen_nic.

-----Original Message-----
From: Eric Dumazet [mailto:eric.dumazet@gmail.com] 
Sent: Wednesday, August 18, 2010 4:13 PM
To: David Miller
Cc: Amit Salecha; netdev
Subject: [PATCH] qlnic: fix a race in qlcnic_get_stats()

Dont clear netdev->stats, it might give transient wrong values to
concurrent stat readers.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 drivers/net/qlcnic/qlcnic_main.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index abd7cd6..d71d44a 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -1980,8 +1980,6 @@ static struct net_device_stats *qlcnic_get_stats(struct net_device *netdev)
 	struct qlcnic_adapter *adapter = netdev_priv(netdev);
 	struct net_device_stats *stats = &netdev->stats;
 
-	memset(stats, 0, sizeof(*stats));
-
 	stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts;
 	stats->tx_packets = adapter->stats.xmitfinished;
 	stats->rx_bytes = adapter->stats.rxbytes + adapter->stats.lrobytes;




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] netxen: fix a race in netxen_nic_get_stats()
  2010-08-18 10:47 ` Amit Salecha
@ 2010-08-18 12:29   ` Eric Dumazet
  2010-08-19  7:44     ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2010-08-18 12:29 UTC (permalink / raw)
  To: Amit Salecha; +Cc: David Miller, netdev

Le mercredi 18 août 2010 à 05:47 -0500, Amit Salecha a écrit :
> Same fix will be require for netxen_nic.

Indeed, here is netxen part

Thanks

[PATCH] netxen: fix a race in netxen_nic_get_stats()

Dont clear netdev->stats, it might give transient wrong values to
concurrent stat readers.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 drivers/net/netxen/netxen_nic_main.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index fd86e18..cb30df1 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -2032,8 +2032,6 @@ struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev)
 	struct netxen_adapter *adapter = netdev_priv(netdev);
 	struct net_device_stats *stats = &netdev->stats;
 
-	memset(stats, 0, sizeof(*stats));
-
 	stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts;
 	stats->tx_packets = adapter->stats.xmitfinished;
 	stats->rx_bytes = adapter->stats.rxbytes;



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] qlnic: fix a race in qlcnic_get_stats()
  2010-08-18 10:42 [PATCH] qlnic: fix a race in qlcnic_get_stats() Eric Dumazet
  2010-08-18 10:47 ` Amit Salecha
@ 2010-08-19  7:44 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2010-08-19  7:44 UTC (permalink / raw)
  To: eric.dumazet; +Cc: amit.salecha, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 18 Aug 2010 12:42:48 +0200

> Dont clear netdev->stats, it might give transient wrong values to
> concurrent stat readers.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] netxen: fix a race in netxen_nic_get_stats()
  2010-08-18 12:29   ` [PATCH] netxen: fix a race in netxen_nic_get_stats() Eric Dumazet
@ 2010-08-19  7:44     ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2010-08-19  7:44 UTC (permalink / raw)
  To: eric.dumazet; +Cc: amit.salecha, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 18 Aug 2010 14:29:30 +0200

> Dont clear netdev->stats, it might give transient wrong values to
> concurrent stat readers.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Also applied, thanks Eric.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-19  7:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-18 10:42 [PATCH] qlnic: fix a race in qlcnic_get_stats() Eric Dumazet
2010-08-18 10:47 ` Amit Salecha
2010-08-18 12:29   ` [PATCH] netxen: fix a race in netxen_nic_get_stats() Eric Dumazet
2010-08-19  7:44     ` David Miller
2010-08-19  7:44 ` [PATCH] qlnic: fix a race in qlcnic_get_stats() David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).