[PATCH] cbus-tahvo: Add tahvo_write_reg locking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tahvo_write_reg() needs to take the mutex to avoid a race
condition with tahvo_set_clear_reg_bits:

tahvo_set_clear_reg_bits():   |  tahvo_write_reg():
    __tahvo_read_reg()        |
                              |      __tahvo_write_reg() <-- race here
    __tahvo_write_reg()       |

Signed-off-by: Michael Buesch <m@xxxxxxx>

---

Index: linux-3.1/drivers/cbus/tahvo.c
===================================================================
--- linux-3.1.orig/drivers/cbus/tahvo.c	2011-11-05 17:03:39.598846119 +0100
+++ linux-3.1/drivers/cbus/tahvo.c	2011-11-05 17:04:36.274768324 +0100
@@ -104,7 +104,9 @@ void tahvo_write_reg(struct device *chil
 {
 	struct tahvo		*tahvo = dev_get_drvdata(child->parent);
 
+	mutex_lock(&tahvo->mutex);
 	__tahvo_write_reg(tahvo, reg, val);
+	mutex_unlock(&tahvo->mutex);
 }
 EXPORT_SYMBOL(tahvo_write_reg);
 


-- 
Greetings, Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux