mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
To: "Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
	gregkh@linuxfoundation.org,
	"Christian König" <christian.koenig@amd.com>
Cc: linux-kernel@vger.kernel.org, Daniel Vetter <daniel@ffwll.ch>
Subject: Re: [PATCH 01/11] misc: fastrpc: Assert held reservation lock for dma-buf mmapping
Date: Thu, 24 Nov 2022 21:03:18 +0300	[thread overview]
Message-ID: <a30bec0c-7471-a144-9a69-f59d952b8970@collabora.com> (raw)
In-Reply-To: <20221124175125.418702-2-srinivas.kandagatla@linaro.org>

On 11/24/22 20:51, Srinivas Kandagatla wrote:
> From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> 
> When userspace mmaps dma-buf's fd, the dma-buf reservation lock must be
> held. Add locking sanity check to the dma-buf mmaping callback to ensure
> that the locking assumption won't regress in the future.
> 
> Suggested-by: Daniel Vetter <daniel@ffwll.ch>
> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  drivers/misc/fastrpc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index 80811e852d8f..c6b9ddaa698b 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -6,6 +6,7 @@
>  #include <linux/device.h>
>  #include <linux/dma-buf.h>
>  #include <linux/dma-mapping.h>
> +#include <linux/dma-resv.h>
>  #include <linux/idr.h>
>  #include <linux/list.h>
>  #include <linux/miscdevice.h>
> @@ -692,6 +693,8 @@ static int fastrpc_mmap(struct dma_buf *dmabuf,
>  	struct fastrpc_buf *buf = dmabuf->priv;
>  	size_t size = vma->vm_end - vma->vm_start;
>  
> +	dma_resv_assert_held(dmabuf->resv);
> +
>  	return dma_mmap_coherent(buf->dev, vma, buf->virt,
>  				 FASTRPC_PHYS(buf->phys), size);
>  }

This patch was already applied to DRM tree together with the rest of
prerequisite dma-buf patches. IOW, it shouldn't be applied separately
via the misc tree.

-- 
Best regards,
Dmitry


  reply	other threads:[~2022-11-24 18:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24 17:51 [PATCH 00/11] misc: fastrpc: patches for 6.2 Srinivas Kandagatla
2022-11-24 17:51 ` [PATCH 01/11] misc: fastrpc: Assert held reservation lock for dma-buf mmapping Srinivas Kandagatla
2022-11-24 18:03   ` Dmitry Osipenko [this message]
2022-11-25  6:58     ` Srinivas Kandagatla
2022-11-24 17:51 ` [PATCH 02/11] dt-bindings: misc: qcom,fastrpc: increase allowed iommus entries Srinivas Kandagatla
2022-11-24 17:51 ` [PATCH 03/11] misc: fastrpc: Rename audio protection domain to root Srinivas Kandagatla
2022-11-24 17:51 ` [PATCH 04/11] misc: fastrpc: Add reserved mem support Srinivas Kandagatla
2022-11-24 17:51 ` [PATCH 05/11] misc: fastrpc: Add fastrpc_remote_heap_alloc Srinivas Kandagatla
2022-11-24 17:51 ` [PATCH 06/11] misc: fastrpc: Use fastrpc_map_put in fastrpc_map_create on fail Srinivas Kandagatla
2022-11-24 17:51 ` [PATCH 07/11] misc: fastrpc: Rework fastrpc_req_munmap Srinivas Kandagatla
2022-11-24 17:51 ` [PATCH 08/11] misc: fastrpc: Add support for audiopd Srinivas Kandagatla
2022-11-24 17:51 ` [PATCH 09/11] misc: fastrpc: Safekeep mmaps on interrupted invoke Srinivas Kandagatla
2022-11-24 17:51 ` [PATCH 10/11] misc: fastrpc: Add mmap request assigning for static PD pool Srinivas Kandagatla
2022-11-24 17:51 ` [PATCH 11/11] misc: fastrpc: Add dma_mask to fastrpc_channel_ctx Srinivas Kandagatla

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=a30bec0c-7471-a144-9a69-f59d952b8970@collabora.com \
    --to=dmitry.osipenko@collabora.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.kandagatla@linaro.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

all inboxes | Powered by JetHome®