devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Abel Vesa <abel.vesa@linaro.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorande@qti.qualcomm.com>,
	Konrad Dybcio <konrad.dybcio@somainline.org>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Amol Maheshwari <amahesh@qti.qualcomm.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Ekansh Gupta <ekangupt@qti.qualcomm.com>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ola Jeppsson <ola@snap.com>
Subject: Re: [PATCH 01/14] misc: fastrpc: Fix use-after-free and race in fastrpc_map_find
Date: Fri, 2 Sep 2022 17:25:19 +0300	[thread overview]
Message-ID: <YxIST6Nb2iYIr+XO@linaro.org> (raw)
In-Reply-To: <YxIENg1AalM46bpi@kroah.com>

On 22-09-02 15:25:10, Greg Kroah-Hartman wrote:
> On Fri, Sep 02, 2022 at 04:13:31PM +0300, Abel Vesa wrote:
> > Currently, there is a race window between the point when the mutex is
> > unlocked in fastrpc_map_lookup and the reference count increasing
> > (fastrpc_map_get) in fastrpc_map_find, which can also lead to
> > use-after-free.
> > 
> > So lets merge fastrpc_map_find into fastrpc_map_lookup which allows us
> > to both protect the maps list by also taking the &fl->lock spinlock and
> > the reference count, since the spinlock will be released only after.
> > Add take_ref argument to make this suitable for all callers.
> > 
> > Co-developed-by: Ola Jeppsson <ola@snap.com>
> > Signed-off-by: Ola Jeppsson <ola@snap.com>
> > Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
> > ---
> >  drivers/misc/fastrpc.c | 41 +++++++++++++++++++++--------------------
> >  1 file changed, 21 insertions(+), 20 deletions(-)
> 
> What commit does this fix?  Should it go to stable trees?

Will specify in the next version.

> 
> Try splitting this series up into 2, one for 6.0-final with bugfixes to
> resolve issues found, and the next one on top of that for new features.

Fair point. Will do in the next version.

> 
> thanks,
> 
> greg k-h

  reply	other threads:[~2022-09-02 14:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02 13:13 [PATCH 00/14] misc: fastrpc: Add audiopd support and some fixes Abel Vesa
2022-09-02 13:13 ` [PATCH 01/14] misc: fastrpc: Fix use-after-free and race in fastrpc_map_find Abel Vesa
2022-09-02 13:25   ` Greg Kroah-Hartman
2022-09-02 14:25     ` Abel Vesa [this message]
2022-09-02 13:13 ` [PATCH 02/14] misc: fastrpc: Don't remove map on creater_process and device_release Abel Vesa
2022-09-02 13:13 ` [PATCH 03/14] misc: fastrpc: Fix use-after-free race condition for maps Abel Vesa
2022-09-02 13:13 ` [PATCH 04/14] misc: fastrpc: Rename audio protection domain to root Abel Vesa
2022-09-02 13:13 ` [PATCH 05/14] misc: fastrpc: Add reserved mem support Abel Vesa
2022-09-02 13:13 ` [PATCH 06/14] dt-bindings: misc: fastrpc: Document memory-region property Abel Vesa
2022-09-02 13:13 ` [PATCH 07/14] misc: fastrpc: Add fastrpc_remote_heap_alloc Abel Vesa
2022-09-02 13:13 ` [PATCH 08/14] misc: fastrpc: Use fastrpc_map_put in fastrpc_map_create on fail Abel Vesa
2022-09-02 13:13 ` [PATCH 09/14] misc: fastrpc: Rework fastrpc_req_munmap Abel Vesa
2022-09-02 13:13 ` [PATCH 10/14] misc: fastrpc: Add support for audiopd Abel Vesa
2022-09-04  4:02   ` kernel test robot
2022-09-02 13:13 ` [PATCH 11/14] misc: fastrpc: Safekeep mmaps on interrupted invoke Abel Vesa
2022-09-02 13:13 ` [PATCH 12/14] misc: fastrpc: Add mmap request assigning for static PD pool Abel Vesa
2022-09-02 13:13 ` [PATCH 13/14] misc: fastrpc: Remove unnecessary if braces in fastrpc_internal_invoke Abel Vesa
2022-09-02 13:13 ` [PATCH 14/14] misc: fastrpc: Add dma_mask to fastrpc_channel_ctx Abel Vesa
2022-09-02 15:06 ` [PATCH 00/14] misc: fastrpc: Add audiopd support and some fixes Abel Vesa

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=YxIST6Nb2iYIr+XO@linaro.org \
    --to=abel.vesa@linaro.org \
    --cc=agross@kernel.org \
    --cc=amahesh@qti.qualcomm.com \
    --cc=arnd@arndb.de \
    --cc=bjorande@qti.qualcomm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=ekangupt@qti.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ola@snap.com \
    --cc=robh@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;
as well as URLs for NNTP newsgroup(s).