[3.13.y-ckt stable] Patch "of/irq: Fix of_irq_parse_one() returned error codes" has been added to staging queue

Kamal Mostafa kamal at canonical.com
Tue Apr 7 22:49:14 UTC 2015


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

    of/irq: Fix of_irq_parse_one() returned error codes

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-ckt19.

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 7245d73a2fde2528f11e817f2bbf30b0e6880b55 Mon Sep 17 00:00:00 2001
From: Laurent Pinchart <laurent.pinchart+renesas at ideasonboard.com>
Date: Wed, 18 Mar 2015 00:21:32 +0200
Subject: of/irq: Fix of_irq_parse_one() returned error codes

commit d7c146053dd195b90c79b9b8131431f44541d015 upstream.

The error code paths that require cleanup use a goto to jump to the
cleanup code and return an error code. However, the error code variable
res, which is initialized to -EINVAL when declared, is then overwritten
with the return value of of_parse_phandle_with_args(), and reused as the
return code from of_irq_parse_one(). This leads to an undetermined error
being returned instead of the expected -EINVAL value. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas at ideasonboard.com>
Signed-off-by: Rob Herring <robh at kernel.org>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
 drivers/of/irq.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 13d4e7c..d8d08f3 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -287,7 +287,7 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar
 	struct device_node *p;
 	const __be32 *intspec, *tmp, *addr;
 	u32 intsize, intlen;
-	int i, res = -EINVAL;
+	int i, res;

 	pr_debug("of_irq_parse_one: dev=%s, index=%d\n", of_node_full_name(device), index);

@@ -320,15 +320,19 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar

 	/* Get size of interrupt specifier */
 	tmp = of_get_property(p, "#interrupt-cells", NULL);
-	if (tmp == NULL)
+	if (tmp == NULL) {
+		res = -EINVAL;
 		goto out;
+	}
 	intsize = be32_to_cpu(*tmp);

 	pr_debug(" intsize=%d intlen=%d\n", intsize, intlen);

 	/* Check index */
-	if ((index + 1) * intsize > intlen)
+	if ((index + 1) * intsize > intlen) {
+		res = -EINVAL;
 		goto out;
+	}

 	/* Copy intspec into irq structure */
 	intspec += index * intsize;
--
1.9.1





More information about the kernel-team mailing list