Re: [PATCH] net: 8390: Fix possible data races in __ei_get_stats

2018-05-08 Thread Jia-Ju Bai
On 2018/5/8 13:04, Eric Dumazet wrote: On 05/07/2018 07:16 PM, Jia-Ju Bai wrote: Yes, ">stats" will not change, because it is a fixed address. But the field data in "dev->stats" is changed (rx_frame_errors, rx_crc_errors and rx_missed_errors). So if the driver returns ">stats" without lock

Re: [PATCH] net: 8390: Fix possible data races in __ei_get_stats

2018-05-08 Thread Jia-Ju Bai
On 2018/5/8 13:04, Eric Dumazet wrote: On 05/07/2018 07:16 PM, Jia-Ju Bai wrote: Yes, ">stats" will not change, because it is a fixed address. But the field data in "dev->stats" is changed (rx_frame_errors, rx_crc_errors and rx_missed_errors). So if the driver returns ">stats" without lock

Re: [PATCH] net: 8390: Fix possible data races in __ei_get_stats

2018-05-07 Thread Eric Dumazet
On 05/07/2018 07:16 PM, Jia-Ju Bai wrote: > Yes, ">stats" will not change, because it is a fixed address. > But the field data in "dev->stats" is changed (rx_frame_errors, rx_crc_errors > and rx_missed_errors). > So if the driver returns ">stats" without lock protection (like on line > 858),

Re: [PATCH] net: 8390: Fix possible data races in __ei_get_stats

2018-05-07 Thread Eric Dumazet
On 05/07/2018 07:16 PM, Jia-Ju Bai wrote: > Yes, ">stats" will not change, because it is a fixed address. > But the field data in "dev->stats" is changed (rx_frame_errors, rx_crc_errors > and rx_missed_errors). > So if the driver returns ">stats" without lock protection (like on line > 858),

Re: [PATCH] net: 8390: Fix possible data races in __ei_get_stats

2018-05-07 Thread Jia-Ju Bai
On 2018/5/8 9:56, Eric Dumazet wrote: On 05/07/2018 05:51 PM, Jia-Ju Bai wrote: On 2018/5/7 22:15, Eric Dumazet wrote: On 05/07/2018 07:08 AM, Jia-Ju Bai wrote: The write operations to "dev->stats" are protected by the spinlock on line 862-864, but the read operations to this data on line

Re: [PATCH] net: 8390: Fix possible data races in __ei_get_stats

2018-05-07 Thread Jia-Ju Bai
On 2018/5/8 9:56, Eric Dumazet wrote: On 05/07/2018 05:51 PM, Jia-Ju Bai wrote: On 2018/5/7 22:15, Eric Dumazet wrote: On 05/07/2018 07:08 AM, Jia-Ju Bai wrote: The write operations to "dev->stats" are protected by the spinlock on line 862-864, but the read operations to this data on line

Re: [PATCH] net: 8390: Fix possible data races in __ei_get_stats

2018-05-07 Thread Eric Dumazet
On 05/07/2018 05:51 PM, Jia-Ju Bai wrote: > > > On 2018/5/7 22:15, Eric Dumazet wrote: >> >> On 05/07/2018 07:08 AM, Jia-Ju Bai wrote: >>> The write operations to "dev->stats" are protected by >>> the spinlock on line 862-864, but the read operations to >>> this data on line 858 and 867 are

Re: [PATCH] net: 8390: Fix possible data races in __ei_get_stats

2018-05-07 Thread Eric Dumazet
On 05/07/2018 05:51 PM, Jia-Ju Bai wrote: > > > On 2018/5/7 22:15, Eric Dumazet wrote: >> >> On 05/07/2018 07:08 AM, Jia-Ju Bai wrote: >>> The write operations to "dev->stats" are protected by >>> the spinlock on line 862-864, but the read operations to >>> this data on line 858 and 867 are

Re: [PATCH] net: 8390: Fix possible data races in __ei_get_stats

2018-05-07 Thread Jia-Ju Bai
On 2018/5/7 22:15, Eric Dumazet wrote: On 05/07/2018 07:08 AM, Jia-Ju Bai wrote: The write operations to "dev->stats" are protected by the spinlock on line 862-864, but the read operations to this data on line 858 and 867 are not protected by the spinlock. Thus, there may exist data races

Re: [PATCH] net: 8390: Fix possible data races in __ei_get_stats

2018-05-07 Thread Jia-Ju Bai
On 2018/5/7 22:15, Eric Dumazet wrote: On 05/07/2018 07:08 AM, Jia-Ju Bai wrote: The write operations to "dev->stats" are protected by the spinlock on line 862-864, but the read operations to this data on line 858 and 867 are not protected by the spinlock. Thus, there may exist data races

Re: [PATCH] net: 8390: Fix possible data races in __ei_get_stats

2018-05-07 Thread Eric Dumazet
On 05/07/2018 07:08 AM, Jia-Ju Bai wrote: > The write operations to "dev->stats" are protected by > the spinlock on line 862-864, but the read operations to > this data on line 858 and 867 are not protected by the spinlock. > Thus, there may exist data races for "dev->stats". > > To fix the

Re: [PATCH] net: 8390: Fix possible data races in __ei_get_stats

2018-05-07 Thread Eric Dumazet
On 05/07/2018 07:08 AM, Jia-Ju Bai wrote: > The write operations to "dev->stats" are protected by > the spinlock on line 862-864, but the read operations to > this data on line 858 and 867 are not protected by the spinlock. > Thus, there may exist data races for "dev->stats". > > To fix the

[PATCH] net: 8390: Fix possible data races in __ei_get_stats

2018-05-07 Thread Jia-Ju Bai
The write operations to "dev->stats" are protected by the spinlock on line 862-864, but the read operations to this data on line 858 and 867 are not protected by the spinlock. Thus, there may exist data races for "dev->stats". To fix the data races, the read operations to "dev->stats" are

[PATCH] net: 8390: Fix possible data races in __ei_get_stats

2018-05-07 Thread Jia-Ju Bai
The write operations to "dev->stats" are protected by the spinlock on line 862-864, but the read operations to this data on line 858 and 867 are not protected by the spinlock. Thus, there may exist data races for "dev->stats". To fix the data races, the read operations to "dev->stats" are