Skip to content

Commit

Permalink
ayufan: mali: midgard: fix memory corruption caused by dereferencing …
Browse files Browse the repository at this point in the history
…the `of_find_compatible_node`

Change-Id: Ic3cd270bae0593b31f0b2b28042493be640d75a6
  • Loading branch information
ayufan committed Mar 19, 2019
1 parent 8024991 commit 5ac37f8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/gpu/arm/midgard/ipa/mali_kbase_ipa.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ static struct device_node *get_model_dt_node(struct kbase_ipa_model *model)
snprintf(compat_string, sizeof(compat_string), "arm,%s",
model->ops->name);

/* of_find_compatible_node() will call of_node_put() on the root node,
* so take a reference on it first.
*/
of_node_get(model->kbdev->dev->of_node);
model_dt_node = of_find_compatible_node(model->kbdev->dev->of_node,
NULL, compat_string);
if (!model_dt_node && !model->missing_dt_node_warning) {
Expand Down

0 comments on commit 5ac37f8

Please sign in to comment.