From: Dan Carpenter <error27@gmail.com>
To: James Kim <james010kim@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, mporter@kernel.crashing.org,
alex.bou9@gmail.com, dan.carpenter@linaro.org,
stable@vger.kernel.org, gregkh@linuxfoundation.org
Subject: Re: [PATCH v2] rapidio: mport_cdev: fix use-after-free in dma_req_free()
Date: Mon, 27 Jul 2026 11:09:50 +0300 [thread overview]
Message-ID: <amcSTqfuYXUWLVOc@stanley.mountain> (raw)
In-Reply-To: <CAPdMtfdA5OkA06KjsBmAGkfqo=N1vmNF+VtbczNdM9Gk5kaV+A@mail.gmail.com>
On Thu, Jul 23, 2026 at 09:48:41AM +0900, James Kim wrote:
> Hi Andrew,
>
> Thanks for the review.
>
> Yes, this path is reachable from userspace through the RapidIO mport
> character-device interface. When the final mapping reference is dropped
> while releasing a DMA request, the subsequent mutex_unlock() may
> dereference freed memory, leading to a kernel crash or a KASAN report.
>
> I'll send a v3 which:
> - updates the Fixes tag to the correct commit,
> - clears req->map while holding md->buf_mutex as suggested, and
> - clarifies the userspace reachability in the commit message.
>
> I'll also review the additional Sashiko findings separately rather than
> mixing them into this fix.
>
These kinds of use after free bugs are hard to detect at runtime unless
you have poisoning enabled. It's freed and then used immediately so
it would be hard for a race condition to change the memory between the
free and the use.
regards,
dan carpenter
next prev parent reply other threads:[~2026-07-27 8:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 7:05 [PATCH v2] rapidio: mport_cdev: fix use-after-free in dma_req_free() James Kim
2026-07-22 0:36 ` James Kim
2026-07-23 8:17 ` Dan Carpenter
2026-07-23 0:18 ` Andrew Morton
2026-07-23 0:21 ` Andrew Morton
2026-07-23 0:48 ` James Kim
2026-07-27 8:09 ` Dan Carpenter [this message]
2026-07-23 23:52 ` [PATCH v3] " James Kim
2026-07-27 7:55 ` James Kim
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=amcSTqfuYXUWLVOc@stanley.mountain \
--to=error27@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alex.bou9@gmail.com \
--cc=dan.carpenter@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=james010kim@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mporter@kernel.crashing.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.