All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V1] Fix Regmap Block Write single-rw Mutex Deadlock
@ 2013-10-09 16:44 Anthony Olech
  2013-10-09 17:49 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Anthony Olech @ 2013-10-09 16:44 UTC (permalink / raw)
  To: Mark Brown, Greg Kroah-Hartman; +Cc: LKML, David Dajun Chen

This patch is relative to linux-next repository tag next-20130927

When regmap_bulk_write() is called with the map->use_single_rw flag set
an immediate mutex deadlock happens because regmap_raw_write() is called
after obtaining the mutex and regmap_raw_write() itself then tries to
obtain the mutex as well.

It is obvious that no one other than myself tried it with a real device.
I did, but only for the purposes of an experiment and demonstration.

But even if this situation will never ever happen with a real device, it
is a bug and therefore should be fixed.

Signed-off-by: Anthony Olech <anthony.olech.opensource@diasemi.com>
---
 drivers/base/regmap/regmap.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 00152bf..6bd9294 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1488,10 +1488,11 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
 	 */
 	if (map->use_single_rw) {
 		for (i = 0; i < val_count; i++) {
-			ret = regmap_raw_write(map,
-					       reg + (i * map->reg_stride),
-					       val + (i * val_bytes),
-					       val_bytes);
+			ret = _regmap_raw_write(map,
+						reg + (i * map->reg_stride),
+						val + (i * val_bytes),
+						val_bytes,
+						false);
 			if (ret != 0)
 				return ret;
 		}
-- 
end-of-patch for Fix Regmap Block Write single-rw Mutex Deadlock V1


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

* Re: [PATCH V1] Fix Regmap Block Write single-rw Mutex Deadlock
  2013-10-09 16:44 [PATCH V1] Fix Regmap Block Write single-rw Mutex Deadlock Anthony Olech
@ 2013-10-09 17:49 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-10-09 17:49 UTC (permalink / raw)
  To: Anthony Olech; +Cc: Greg Kroah-Hartman, LKML, David Dajun Chen

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

On Wed, Oct 09, 2013 at 05:44:38PM +0100, Anthony Olech wrote:

Applied, thanks.  Please format your patches as covered in
SubmittingPatches - use subjects appropriate to the subsystem and keep
noise like the above after the ---.  I've fixed these and the strange
capitalisation when applying.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2013-10-09 17:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-09 16:44 [PATCH V1] Fix Regmap Block Write single-rw Mutex Deadlock Anthony Olech
2013-10-09 17:49 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.