netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] e1000e: fix mismatch in mutex lock-unlock in e1000_reset_hw_82571()
@ 2013-04-19  5:15 Alexey Khoroshilov
  2013-04-19  6:44 ` Jeff Kirsher
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Khoroshilov @ 2013-04-19  5:15 UTC (permalink / raw)
  To: Jeff Kirsher
  Cc: ldv-project, e1000-devel, Bruce Allan, Jesse Brandeburg,
	linux-kernel, netdev, Alexey Khoroshilov

If e1000_get_hw_semaphore_82574() succeed, it acquires swflag_mutex,
otherwise it does not. But the returned value of
e1000_get_hw_semaphore_82574() is ignored, so unlocking of swflag_mutex
happens anyway.

The patch fixes the issue by breaking reset if MIC ownership is not acquired.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/net/ethernet/intel/e1000e/82571.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/e1000e/82571.c b/drivers/net/ethernet/intel/e1000e/82571.c
index 2faffbd..a6bd80e 100644
--- a/drivers/net/ethernet/intel/e1000e/82571.c
+++ b/drivers/net/ethernet/intel/e1000e/82571.c
@@ -1003,8 +1003,10 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
 	default:
 		break;
 	}
-	if (ret_val)
+	if (ret_val) {
 		e_dbg("Cannot acquire MDIO ownership\n");
+		return ret_val;
+	}
 
 	ctrl = er32(CTRL);
 
-- 
1.7.9.5


------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

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

* Re: [PATCH] e1000e: fix mismatch in mutex lock-unlock in e1000_reset_hw_82571()
  2013-04-19  5:15 [PATCH] e1000e: fix mismatch in mutex lock-unlock in e1000_reset_hw_82571() Alexey Khoroshilov
@ 2013-04-19  6:44 ` Jeff Kirsher
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Kirsher @ 2013-04-19  6:44 UTC (permalink / raw)
  To: Alexey Khoroshilov
  Cc: Jesse Brandeburg, Bruce Allan, Carolyn Wyborny, Don Skidmore,
	Greg Rose, Peter P Waskiewicz Jr, Alex Duyck, e1000-devel, netdev,
	linux-kernel, ldv-project

[-- Attachment #1: Type: text/plain, Size: 678 bytes --]

On Thu, 2013-04-18 at 22:15 -0700, Alexey Khoroshilov wrote:
> If e1000_get_hw_semaphore_82574() succeed, it acquires swflag_mutex,
> otherwise it does not. But the returned value of
> e1000_get_hw_semaphore_82574() is ignored, so unlocking of
> swflag_mutex
> happens anyway.
> 
> The patch fixes the issue by breaking reset if MIC ownership is not
> acquired.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> ---
>  drivers/net/ethernet/intel/e1000e/82571.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-) 

Thanks Alexey, I have added your patch to my queue.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2013-04-19  6:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-19  5:15 [PATCH] e1000e: fix mismatch in mutex lock-unlock in e1000_reset_hw_82571() Alexey Khoroshilov
2013-04-19  6:44 ` Jeff Kirsher

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).