VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   57 Tags
author: Stefan Richter <stefanr@s5r6.in-berlin.de> 2014-03-03 23:22:35 +0100 committer: Stefan Richter <stefanr@s5r6.in-berlin.de> 2014-12-10 20:53:20 +0100 commit: 0765cbd3be699b4a72db67069247d514f06a1e4f parent: 0238507b951857360461b0635111e7376ffd44d1
Commit Summary:
firewire: sbp2: protect a reference counter properly
Diffstat:
1 file changed, 5 insertions, 7 deletions
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c
index 7aef911fdc71..c7fc78c23978 100644
--- a/drivers/firewire/sbp2.c
+++ b/drivers/firewire/sbp2.c
@@ -689,14 +689,12 @@ static void sbp2_agent_reset_no_wait(struct sbp2_logical_unit *lu)
 
 static inline void sbp2_allow_block(struct sbp2_logical_unit *lu)
 {
-	/*
-	 * We may access dont_block without taking card->lock here:
-	 * All callers of sbp2_allow_block() and all callers of sbp2_unblock()
-	 * are currently serialized against each other.
-	 * And a wrong result in sbp2_conditionally_block()'s access of
-	 * dont_block is rather harmless, it simply misses its first chance.
-	 */
-	--lu->tgt->dont_block;
+	struct sbp2_target *tgt = lu->tgt;
+	struct fw_card *card = target_parent_device(tgt)->card;
+
+	spin_lock_irq(&card->lock);
+	--tgt->dont_block;
+	spin_unlock_irq(&card->lock);
 }
 
 /*