staging: ion: WARN when the handle kmap_cnt is going to wrap around
Subsystems (2)
PATCH 1/1 staging: ion: WARN when the handle kmap_cnt is going to wrap around
There are certain client bugs (double unmap, for example) that can cause the handle->kmap_cnt (an unsigned int) to wrap around from zero. This causes problems when the handle is destroyed because we have:
while (handle->kmap_cnt)
ion_handle_kmap_put(handle);which takes a long time to complete when kmap_cnt starts at ~0 and can result in a watchdog timeout.
WARN and bail when kmap_cnt is about to wrap around from zero.
--- drivers/staging/android/ion/ion.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/staging/android/ion/ion.c +4 -0
@@ -626,6 +626,10 @@ static void ion_handle_kmap_put(struct ion_handle *handle) {struct ion_buffer *buffer = handle->buffer; +if (!handle->kmap_cnt) { +WARN (1 ,"%s: Double unmap detected! bailing...\n" , __func__); +return ; + } handle->kmap_cnt--;if (!handle->kmap_cnt)ion_buffer_kmap_put (buffer);
Signature · 8 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 36 lines · Mitchel Humpherys
There are certain client bugs (double unmap, for example) that can cause the
handle->kmap_cnt(an unsigned int) to wrap around from zero. This causes problems when the handle is destroyed because we have:while (handle->kmap_cnt) ion_handle_kmap_put(handle);which takes a long time to complete when
kmap_cntstarts at ~0 and can result in a watchdog timeout.WARN and bail when
kmap_cntis about to wrap around from zero.Signed-off-by Mitchel Humpherys <[email protected]>--- drivers/staging/android/ion/ion.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/staging/android/ion/ion.c +4
-1@@ -626,6 +626,10 @@ static void ion_handle_kmap_put(struct ion_handle *handle) {struct ion_buffer *buffer = handle->buffer; +if (!handle->kmap_cnt) { +WARN (1 ,"%s: Double unmap detected! bailing...\n" , __func__); +return ; + } handle->kmap_cnt--;if (!handle->kmap_cnt)ion_buffer_kmap_put (buffer); --The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
++greg-kh and [email protected]
(my bad for missing you the first time around)
Quoted 41 lines · Colin Cross
Quoted 36 lines · Mitchel Humpherys
There are certain client bugs (double unmap, for example) that can cause the
handle->kmap_cnt(an unsigned int) to wrap around from zero. This causes problems when the handle is destroyed because we have:while (handle->kmap_cnt) ion_handle_kmap_put(handle);which takes a long time to complete when
kmap_cntstarts at ~0 and can result in a watchdog timeout.WARN and bail when
kmap_cntis about to wrap around from zero.Signed-off-by Mitchel Humpherys <[email protected]>--- drivers/staging/android/ion/ion.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/staging/android/ion/ion.c +4
-1@@ -626,6 +626,10 @@ static void ion_handle_kmap_put(struct ion_handle *handle) {struct ion_buffer *buffer = handle->buffer; +if (!handle->kmap_cnt) { +WARN (1 ,"%s: Double unmap detected! bailing...\n" , __func__); +return ; + } handle->kmap_cnt--;if (!handle->kmap_cnt)ion_buffer_kmap_put (buffer); --The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
Acked-by Colin Cross <[email protected]>
Signature · 8 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Greg Kroah-Hartman
maintainerQuoted 2 lines · Mitchel Humpherys
++greg-kh and [email protected]
(my bad for missing you the first time around)
What can I do with this? Please send patches to me in a format that I can actually apply them in...
thanks,
greg k-h
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>