RE: [PATCH 2/2] e1000e: Fix link check race condition

2018-03-09 Thread Brown, Aaron F
> From: netdev-ow...@vger.kernel.org [mailto:netdev-
> ow...@vger.kernel.org] On Behalf Of Benjamin Poirier
> Sent: Monday, March 5, 2018 5:56 PM
> To: Kirsher, Jeffrey T 
> Cc: Alexander Duyck ; Lennart Sorensen
> ; intel-wired-...@lists.osuosl.org;
> netdev@vger.kernel.org; linux-ker...@vger.kernel.org
> Subject: [PATCH 2/2] e1000e: Fix link check race condition
> 
> Alex reported the following race condition:
> 
> /* link goes up... interrupt... schedule watchdog */
> \ e1000_watchdog_task
>   \ e1000e_has_link
>   \ hw->mac.ops.check_for_link() ===
> e1000e_check_for_copper_link
>   \ e1000e_phy_has_link_generic(..., )
>   link = true
> 
>/* link goes down... interrupt */
>\ e1000_msix_other
>hw->mac.get_link_status =
> true
> 
>   /* link is up */
>   mac->get_link_status = false
> 
>   link_active = true
>   /* link_active is true, wrongly, and stays so because
>* get_link_status is false */
> 
> Avoid this problem by making sure that we don't set get_link_status = false
> after having checked the link.
> 
> It seems this problem has been present since the introduction of e1000e.
> 
> Link: https://lkml.org/lkml/2018/1/29/338
> Reported-by: Alexander Duyck 
> Signed-off-by: Benjamin Poirier 
> ---
>  drivers/net/ethernet/intel/e1000e/ich8lan.c | 31 ---
> --
>  drivers/net/ethernet/intel/e1000e/mac.c | 14 ++---
>  2 files changed, 24 insertions(+), 21 deletions(-)

Tested-by: Aaron Brown 


Re: [PATCH 2/2] e1000e: Fix link check race condition

2018-03-06 Thread Alexander Duyck
On Mon, Mar 5, 2018 at 5:55 PM, Benjamin Poirier  wrote:
> Alex reported the following race condition:
>
> /* link goes up... interrupt... schedule watchdog */
> \ e1000_watchdog_task
> \ e1000e_has_link
> \ hw->mac.ops.check_for_link() === 
> e1000e_check_for_copper_link
> \ e1000e_phy_has_link_generic(..., )
> link = true
>
>  /* link goes down... interrupt */
>  \ e1000_msix_other
>  hw->mac.get_link_status = 
> true
>
> /* link is up */
> mac->get_link_status = false
>
> link_active = true
> /* link_active is true, wrongly, and stays so because
>  * get_link_status is false */
>
> Avoid this problem by making sure that we don't set get_link_status = false
> after having checked the link.
>
> It seems this problem has been present since the introduction of e1000e.
>
> Link: https://lkml.org/lkml/2018/1/29/338
> Reported-by: Alexander Duyck 
> Signed-off-by: Benjamin Poirier 

Looks good. Thanks.

Acked-by: Alexander Duyck