forked from luck/tmp_suning_uos_patched
staging: ion: Prevent incorrect reference counting behavour
Supply additional check in order to prevent unexpected results.
Fixes: b892bf75b2
("ion: Switch ion to use dma-buf")
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
dccee748af
commit
fea24b07ed
|
@ -114,6 +114,9 @@ static void *ion_buffer_kmap_get(struct ion_buffer *buffer)
|
|||
void *vaddr;
|
||||
|
||||
if (buffer->kmap_cnt) {
|
||||
if (buffer->kmap_cnt == INT_MAX)
|
||||
return ERR_PTR(-EOVERFLOW);
|
||||
|
||||
buffer->kmap_cnt++;
|
||||
return buffer->vaddr;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user