* [PATCH v3 1/1] staging: ion: Prevent incorrect reference counting behavour
@ 2021-11-26 10:33 Lee Jones
2021-11-26 10:36 ` Dan Carpenter
2021-11-27 11:57 ` Greg KH
0 siblings, 2 replies; 3+ messages in thread
From: Lee Jones @ 2021-11-26 10:33 UTC (permalink / raw)
To: lee.jones
Cc: stable, labbott, sumit.semwal, arve, riandrews, devel,
Dan Carpenter
Supply additional checks in order to prevent unexpected results.
Fixes: b892bf75b2034 ("ion: Switch ion to use dma-buf")
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
Destined for v4.4.y and v4.9.y
drivers/staging/android/ion/ion.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 806e9b30b9dc8..aac9b38b8c25c 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -489,6 +489,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;
}
@@ -509,6 +512,9 @@ static void *ion_handle_kmap_get(struct ion_handle *handle)
void *vaddr;
if (handle->kmap_cnt) {
+ if (handle->kmap_cnt == INT_MAX)
+ return ERR_PTR(-EOVERFLOW);
+
handle->kmap_cnt++;
return buffer->vaddr;
}
--
2.34.0.rc2.393.gf8c9666880-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3 1/1] staging: ion: Prevent incorrect reference counting behavour
2021-11-26 10:33 [PATCH v3 1/1] staging: ion: Prevent incorrect reference counting behavour Lee Jones
@ 2021-11-26 10:36 ` Dan Carpenter
2021-11-27 11:57 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-11-26 10:36 UTC (permalink / raw)
To: Lee Jones; +Cc: devel, arve, stable, riandrews, labbott, sumit.semwal
On Fri, Nov 26, 2021 at 10:33:35AM +0000, Lee Jones wrote:
> Supply additional checks in order to prevent unexpected results.
>
> Fixes: b892bf75b2034 ("ion: Switch ion to use dma-buf")
> Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
> Destined for v4.4.y and v4.9.y
Thanks!
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3 1/1] staging: ion: Prevent incorrect reference counting behavour
2021-11-26 10:33 [PATCH v3 1/1] staging: ion: Prevent incorrect reference counting behavour Lee Jones
2021-11-26 10:36 ` Dan Carpenter
@ 2021-11-27 11:57 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2021-11-27 11:57 UTC (permalink / raw)
To: Lee Jones
Cc: devel, arve, stable, riandrews, labbott, sumit.semwal,
Dan Carpenter
On Fri, Nov 26, 2021 at 10:33:35AM +0000, Lee Jones wrote:
> Supply additional checks in order to prevent unexpected results.
>
> Fixes: b892bf75b2034 ("ion: Switch ion to use dma-buf")
> Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
> Destined for v4.4.y and v4.9.y
>
> drivers/staging/android/ion/ion.c | 6 ++++++
> 1 file changed, 6 insertions(+)
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-27 11:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-26 10:33 [PATCH v3 1/1] staging: ion: Prevent incorrect reference counting behavour Lee Jones
2021-11-26 10:36 ` Dan Carpenter
2021-11-27 11:57 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox