[3.13.y-ckt stable] Patch "[3.13-stable only] regmap: fix kernel hang on regmap_bulk_write with zero val_count." has been added to staging queue

Kamal Mostafa kamal at canonical.com
Thu Nov 13 16:28:50 UTC 2014


This is a note to let you know that I have just added a patch titled

    [3.13-stable only] regmap: fix kernel hang on regmap_bulk_write with zero val_count.

to the linux-3.13.y-queue branch of the 3.13.y-ckt extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.13.y-queue

This patch is scheduled to be released in version 3.13.11-ckt12.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.13.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

>From fcde060aea460c6b7b71d7c42ad930a62be9798e Mon Sep 17 00:00:00 2001
From: Quentin Casasnovas <quentin.casasnovas at oracle.com>
Date: Wed, 12 Nov 2014 11:19:23 +0100
Subject: [3.13-stable only] regmap: fix kernel hang on regmap_bulk_write with
 zero val_count.

If val_count is zero we return -EINVAL with map->lock_arg locked, which
will deadlock the kernel next time we try to acquire this lock.

This was introduced by 6ae8fcd ("regmap: fix possible ZERO_SIZE_PTR pointer
dereferencing error.") which improperly back-ported d6b41cb0.

This issue was found during review of Ubuntu Trusty 3.13.0-40.68 kernel to
prepare Ksplice rebootless updates.

Fixes: [3.13-stable] 6ae8fcd ("regmap: fix possible ZERO_SIZE_PTR pointer dereferencing error.")
Fixes: [Ubuntu Trusty] f5942dd ("regmap: fix possible ZERO_SIZE_PTR pointer dereferencing error.")
Signed-off-by: Quentin Casasnovas <quentin.casasnovas at oracle.com>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
 drivers/base/regmap/regmap.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index ebe332c..9e885cf 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1529,8 +1529,10 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
 	if (val_bytes == 1) {
 		wval = (void *)val;
 	} else {
-		if (!val_count)
-			return -EINVAL;
+		if (!val_count) {
+			ret = -EINVAL;
+			goto out;
+		}

 		wval = kmemdup(val, val_count * val_bytes, GFP_KERNEL);
 		if (!wval) {
--
1.9.1





More information about the kernel-team mailing list