netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: mjr@cs.wisc.edu
To: davem@davemloft.net
Cc: sboyd@codeaurora.org, ben@simtec.co.uk, netdev@vger.kernel.org,
	Matt Renzelmann <mjr@cs.wisc.edu>
Subject: [PATCH] Fix missing mutex_lock/unlock
Date: Thu, 12 Apr 2012 10:26:36 -0500	[thread overview]
Message-ID: <1334244396-6978-1-git-send-email-mjr@cs.wisc.edu> (raw)

From: Matt Renzelmann <mjr@cs.wisc.edu>

All calls to ks8851_rdreg* and ks8851_wrreg* should be protected
with the driver's lock mutex.  A spurious interrupt may otherwise cause a
crash.

Signed-off-by: Matt Renzelmann <mjr@cs.wisc.edu>
---
Hello,

I'm new to the kernel development process so I hope I've not screwed
this up with this extra text.  We found a potential issue using a new
driver testing tool called SymDrive.  It looks legitimate to me, so
I'm reporting it.  We hope to make this tool available in the future.
Please let me know if I should modify the patch or re-send without
this commentary.  Thanks in advance for your patience.

 drivers/net/ethernet/micrel/ks8851.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
index c722aa6..fa2001a 100644
--- a/drivers/net/ethernet/micrel/ks8851.c
+++ b/drivers/net/ethernet/micrel/ks8851.c
@@ -1515,11 +1515,15 @@ static int __devinit ks8851_probe(struct spi_device *spi)
 		goto err_netdev;
 	}
 
+	mutex_lock(&ks->lock);
+
 	netdev_info(ndev, "revision %d, MAC %pM, IRQ %d, %s EEPROM\n",
 		    CIDER_REV_GET(ks8851_rdreg16(ks, KS_CIDER)),
 		    ndev->dev_addr, ndev->irq,
 		    ks->rc_ccr & CCR_EEPROM ? "has" : "no");
 
+	mutex_unlock(&ks->lock);
+
 	return 0;
 
 
-- 
1.7.5.4

             reply	other threads:[~2012-04-12 15:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-12 15:26 mjr [this message]
2012-04-12 19:23 ` [PATCH] Fix missing mutex_lock/unlock Flavio Leitner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1334244396-6978-1-git-send-email-mjr@cs.wisc.edu \
    --to=mjr@cs.wisc.edu \
    --cc=ben@simtec.co.uk \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=sboyd@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).