Skip to content

Commit

Permalink
component: fix bug with legacy API
Browse files Browse the repository at this point in the history
Sachin Kamat reports that "component: add support for component match
array" broke Exynos DRM due to a NULL pointer deref.  Fix this.

Reported-by: Sachin Kamat <sachin.kamat@samsung.com>
Tested-by: Sachin Kamat <sachin.kamat@samsung.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Russell King committed Jul 4, 2014
1 parent 6955b58 commit b509cc8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/base/component.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b509cc8

Please sign in to comment.