public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Charan Teja Kalla <charante@codeaurora.org>
To: David Laight <David.Laight@ACULAB.COM>,
	"Ruhl, Michael J" <michael.j.ruhl@intel.com>,
	Sumit Semwal <sumit.semwal@linaro.org>,
	"open list:DMA BUFFER SHARING FRAMEWORK" 
	<linux-media@vger.kernel.org>,
	DRI mailing list <dri-devel@lists.freedesktop.org>
Cc: Linaro MM SIG <linaro-mm-sig@lists.linaro.org>,
	"vinmenon@codeaurora.org" <vinmenon@codeaurora.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH] dmabuf: use spinlock to access dmabuf->name
Date: Wed, 17 Jun 2020 19:13:12 +0530	[thread overview]
Message-ID: <dcf2bdd6-d6fd-96f0-c6e7-6788ea282e35@codeaurora.org> (raw)
In-Reply-To: <b686a288cff640acaea1111fed650b02@AcuMS.aculab.com>



On 6/17/2020 1:51 PM, David Laight wrote:
> From: Charan Teja Kalla
>> Sent: 17 June 2020 07:29
> ...
>>>> If name is freed you will copy garbage, but the only way
>>>> for that to happen is that _set_name or _release have to be called
>>>> at just the right time.
>>>>
>>>> And the above would probably only be an issue if the set_name
>>>> was called, so you will get NULL or a real name.
>>
>> And there exists a use-after-free to avoid which requires the lock. Say
>> that memcpy() in dmabuffs_dname is in progress and in parallel _set_name
>> will free the same buffer that memcpy is operating on.
> 
> If the name is being looked at while the item is being freed
> you almost certainly have much bigger problems that just
> the name being a 'junk' pointer.

True, thus needs the lock.

> 
> 	David.
> 
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)
> 

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum, a Linux Foundation Collaborative Project

  reply	other threads:[~2020-06-17 13:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11 13:39 [PATCH] dmabuf: use spinlock to access dmabuf->name Charan Teja Kalla
2020-06-16 12:40 ` Sumit Semwal
2020-06-16 13:51 ` Ruhl, Michael J
2020-06-16 13:59   ` Ruhl, Michael J
2020-06-17  6:28     ` Charan Teja Kalla
2020-06-17  8:21       ` David Laight
2020-06-17 13:43         ` Charan Teja Kalla [this message]
2020-06-17 17:43       ` Ruhl, Michael J
2020-06-18  9:58         ` Charan Teja Kalla

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=dcf2bdd6-d6fd-96f0-c6e7-6788ea282e35@codeaurora.org \
    --to=charante@codeaurora.org \
    --cc=David.Laight@ACULAB.COM \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=michael.j.ruhl@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=sumit.semwal@linaro.org \
    --cc=vinmenon@codeaurora.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