msm: kgsl: Bail out when two threads add sparse bindings
If we find that a different thread has already added bindings at the same offset we wanted to add to the sparse object, don't get stuck in an infinite loop, and return with an error. Change-Id: I6b17c91eccb14c07e13cae24135dfe7b13f3301d Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
This commit is contained in:
parent
bd20893138
commit
5b4f3d1608
1 changed files with 8 additions and 2 deletions
|
@ -3467,10 +3467,16 @@ static int _sparse_add_to_bind_tree(struct kgsl_mem_entry *entry,
|
||||||
parent = *node;
|
parent = *node;
|
||||||
this = rb_entry(parent, struct sparse_bind_object, node);
|
this = rb_entry(parent, struct sparse_bind_object, node);
|
||||||
|
|
||||||
if (new->v_off < this->v_off)
|
if ((new->v_off < this->v_off) &&
|
||||||
|
((new->v_off + new->size) <= this->v_off))
|
||||||
node = &parent->rb_left;
|
node = &parent->rb_left;
|
||||||
else if (new->v_off > this->v_off)
|
else if ((new->v_off > this->v_off) &&
|
||||||
|
(new->v_off >= (this->v_off + this->size)))
|
||||||
node = &parent->rb_right;
|
node = &parent->rb_right;
|
||||||
|
else {
|
||||||
|
kfree(new);
|
||||||
|
return -EADDRINUSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rb_link_node(&new->node, parent, node);
|
rb_link_node(&new->node, parent, node);
|
||||||
|
|
Loading…
Add table
Reference in a new issue