Skip to contentSkip to conversation

component: add support for component match array

PATCH New Russell King - ARM Linux 2 participants 4 messages Jul 4, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CAK5sBcEupbnzpxskD8D7wXbFRfU+4gh5oDE9X-SvkZEQ2+dQ_w@mail.gmail.com

#1 lore raw

PATCH v3 3/8 component: add support for component match array

Quoted 16 lines · Sachin Kamat

Hi Russell

Review

Quoted 12 lines
(quoted diff) +8 -0
+int component_master_add_with_match(struct device *dev,
+       const struct component_master_ops *ops,
+       struct component_match *match)
 {
        struct master *master;
        int ret;
 
+       if (ops->add_components && match)
+               return -EINVAL;
+
+       /* Reallocate the match array for its true size */
+       match = component_match_realloc(dev, match, match->num);
           ^^^^^^^^^^^^^
Quoted 3 lines

This gives a NULL pointer dereference error when match is NULL (as passed by component_master_add() below). Observed this while testing linux-next kernel (next-20140704) on Exynos based board with DRM enabled.

Thanks for your report. Please verify that the patch below resolves it for you. Thanks.

 drivers/base/component.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/base/component.c +6 -4
index b4236daed4fa..f748430bb654 100644
@@ -293,10 +293,12 @@ int component_master_add_with_match(struct device *dev,
 	if (ops->add_components && match)
 		return -EINVAL;
 
-	/* Reallocate the match array for its true size */
-	match = component_match_realloc(dev, match, match->num);
-	if (IS_ERR(match))
-		return PTR_ERR(match);
+	if (match) {
+		/* Reallocate the match array for its true size */
+		match = component_match_realloc(dev, match, match->num);
+		if (IS_ERR(match))
+			return PTR_ERR(match);
+	}
 
 	master = kzalloc(sizeof(*master), GFP_KERNEL);
 	if (!master)
Signature · 2 lines
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
#2 lore raw

PATCH v3 3/8 component: add support for component match array

Quoted 21 lines · Russell King - ARM Linux
Quoted 16 lines · Sachin Kamat

Hi Russell

Review

Quoted 12 lines
(quoted diff) +8 -0
+int component_master_add_with_match(struct device *dev,
+       const struct component_master_ops *ops,
+       struct component_match *match)
 {
        struct master *master;
        int ret;
 
+       if (ops->add_components && match)
+               return -EINVAL;
+
+       /* Reallocate the match array for its true size */
+       match = component_match_realloc(dev, match, match->num);
           ^^^^^^^^^^^^^
Quoted 3 lines

This gives a NULL pointer dereference error when match is NULL (as passed by component_master_add() below). Observed this while testing linux-next kernel (next-20140704) on Exynos based board with DRM enabled.

Quoted 2 lines

Thanks for your report. Please verify that the patch below resolves it for you. Thanks.

Yes, the below patch fixes the crash. Thanks for the fix.

Quoted 30 lines
 drivers/base/component.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/base/component.c +6 -5
index b4236daed4fa..f748430bb654 100644
@@ -293,10 +293,12 @@ int component_master_add_with_match(struct device *dev,
        if (ops->add_components && match)
                return -EINVAL;
 
-       /* Reallocate the match array for its true size */
-       match = component_match_realloc(dev, match, match->num);
-       if (IS_ERR(match))
-               return PTR_ERR(match);
+       if (match) {
+               /* Reallocate the match array for its true size */
+               match = component_match_realloc(dev, match, match->num);
+               if (IS_ERR(match))
+                       return PTR_ERR(match);
+       }
 
        master = kzalloc(sizeof(*master), GFP_KERNEL);
        if (!master)
 
 
--

FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly improving, and getting towards what was expected from it.

Signature · 2 lines
Regards,
Sachin.
#3 lore raw

PATCH v3 3/8 component: add support for component match array

Quoted 23 lines · Sachin Kamat
Quoted 21 lines · Russell King - ARM Linux
Quoted 19 lines · Sachin Kamat

Hi Russell

Review

Quoted 12 lines
(quoted diff) +8 -0
+int component_master_add_with_match(struct device *dev,
+       const struct component_master_ops *ops,
+       struct component_match *match)
 {
        struct master *master;
        int ret;
 
+       if (ops->add_components && match)
+               return -EINVAL;
+
+       /* Reallocate the match array for its true size */
+       match = component_match_realloc(dev, match, match->num);
           ^^^^^^^^^^^^^

This gives a NULL pointer dereference error when match is NULL (as passed by component_master_add() below). Observed this while testing linux-next kernel (next-20140704) on Exynos based board with DRM enabled.

Quoted 4 lines
Quoted 2 lines

Thanks for your report. Please verify that the patch below resolves it for you. Thanks.

Yes, the below patch fixes the crash. Thanks for the fix.

Thanks. I'll add a tested-by and reported-by for your address when committing this patch. Let me know if you want something different.

Signature · 2 lines
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
#4 lore raw

PATCH v3 3/8 component: add support for component match array

Quoted 24 lines · Russell King - ARM Linux
Quoted 23 lines · Sachin Kamat
Quoted 21 lines · Russell King - ARM Linux
Quoted 19 lines · Sachin Kamat

Hi Russell

Review

Quoted 12 lines
(quoted diff) +8 -0
+int component_master_add_with_match(struct device *dev,
+       const struct component_master_ops *ops,
+       struct component_match *match)
 {
        struct master *master;
        int ret;
 
+       if (ops->add_components && match)
+               return -EINVAL;
+
+       /* Reallocate the match array for its true size */
+       match = component_match_realloc(dev, match, match->num);
           ^^^^^^^^^^^^^

This gives a NULL pointer dereference error when match is NULL (as passed by component_master_add() below). Observed this while testing linux-next kernel (next-20140704) on Exynos based board with DRM enabled.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Thanks for your report. Please verify that the patch below resolves it for you. Thanks.

Yes, the below patch fixes the crash. Thanks for the fix.

Thanks. I'll add a tested-by and reported-by for your address when committing this patch. Let me know if you want something different.

Thanks. Please use the following for the tags:

Sachin Kamat <[email protected]>

Signature · 2 lines
Regards,
Sachin.