This is a note to let you know that I've just added the patch titled staging: ion: Prevent incorrect reference counting behavour to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: staging-ion-prevent-incorrect-reference-counting-behavour.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From lee.jones@xxxxxxxxxx Mon Apr 25 17:58:17 2022 From: Lee Jones <lee.jones@xxxxxxxxxx> Date: Mon, 25 Apr 2022 16:51:54 +0100 Subject: staging: ion: Prevent incorrect reference counting behavour To: lee.jones@xxxxxxxxxx Cc: stable@xxxxxxxxxxxxxxx, Dan Carpenter <dan.carpenter@xxxxxxxxxx> Message-ID: <20220425155154.2742426-1-lee.jones@xxxxxxxxxx> Supply additional check in order to prevent unexpected results. Fixes: b892bf75b2034 ("ion: Switch ion to use dma-buf") Suggested-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Signed-off-by: Lee Jones <lee.jones@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/android/ion/ion.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -140,6 +140,9 @@ static void *ion_buffer_kmap_get(struct void *vaddr; if (buffer->kmap_cnt) { + if (buffer->kmap_cnt == INT_MAX) + return ERR_PTR(-EOVERFLOW); + buffer->kmap_cnt++; return buffer->vaddr; } Patches currently in stable-queue which might be from lee.jones@xxxxxxxxxx are queue-4.19/staging-ion-prevent-incorrect-reference-counting-behavour.patch