public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Lee Jones <lee.jones@linaro.org>
Cc: stable@vger.kernel.org, Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH 1/1] staging: ion: Prevent incorrect reference counting behavour
Date: Mon, 25 Apr 2022 17:59:38 +0200	[thread overview]
Message-ID: <YmbFatGdeHcjXml9@kroah.com> (raw)
In-Reply-To: <20220425155154.2742426-1-lee.jones@linaro.org>

On Mon, Apr 25, 2022 at 04:51:54PM +0100, Lee Jones wrote:
> Supply additional check 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>
> ---
> This is a forward-port from linux-4.4.y and linux-4.9.y.
> 
> It has never been upstream.
> 
> Please apply to v4.14 through v5.10.
> 
>  drivers/staging/android/ion/ion.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
> index e1fe03ceb7f13..e6d4a3ee6cda5 100644
> --- a/drivers/staging/android/ion/ion.c
> +++ b/drivers/staging/android/ion/ion.c
> @@ -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;
>  	}
> -- 
> 2.36.0.rc2.479.g8af0fa9b8e-goog
> 

Now queued up, thanks.

gre gk-h

  reply	other threads:[~2022-04-25 15:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-25 15:51 [PATCH 1/1] staging: ion: Prevent incorrect reference counting behavour Lee Jones
2022-04-25 15:59 ` Greg KH [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-11-25 14:20 Lee Jones
2021-11-25 14:50 ` Dan Carpenter
2021-11-25 15:07   ` Lee Jones
2021-11-25 15:15     ` Lee Jones
2021-11-25 15:18     ` Dan Carpenter
2021-11-25 15:28       ` Lee Jones
2021-11-26  7:16       ` Dan Carpenter
2021-11-26  8:56         ` Lee Jones
2021-11-26  9:02           ` Dan Carpenter
2021-11-26  9:03           ` Greg KH
2021-11-26  9:12             ` Lee Jones
2021-11-25 12:02 Lee Jones
2021-11-25 12:15 ` Greg KH
2021-11-25 12:46   ` Lee Jones
2021-11-25 12:54     ` Greg KH
2021-11-25 13:03       ` Lee Jones
2021-11-25 13:06         ` Greg KH
2021-11-25 13:11           ` Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YmbFatGdeHcjXml9@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=dan.carpenter@oracle.com \
    --cc=lee.jones@linaro.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox