From: Jens Axboe <axboe@kernel.dk>
To: Sahitya Tummala <stummala@codeaurora.org>, linux-block@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Pradeep P V K <ppvk@codeaurora.org>
Subject: Re: [PATCH] block: Fix use-after-free issue accessing struct io_cq
Date: Wed, 11 Mar 2020 06:59:34 -0600 [thread overview]
Message-ID: <da11e249-904f-6cec-03b6-ce4b8d7eb1e1@kernel.dk> (raw)
In-Reply-To: <1583923070-22245-1-git-send-email-stummala@codeaurora.org>
On 3/11/20 4:37 AM, Sahitya Tummala wrote:
> There is a potential race between ioc_release_fn() and
> ioc_clear_queue() as shown below, due to which below kernel
> crash is observed. It also can result into use-after-free
> issue.
>
> context#1: context#2:
> ioc_release_fn() __ioc_clear_queue() gets the same icq
> ->spin_lock(&ioc->lock); ->spin_lock(&ioc->lock);
> ->ioc_destroy_icq(icq);
> ->list_del_init(&icq->q_node);
> ->call_rcu(&icq->__rcu_head,
> icq_free_icq_rcu);
> ->spin_unlock(&ioc->lock);
> ->ioc_destroy_icq(icq);
> ->hlist_del_init(&icq->ioc_node);
> This results into below crash as this memory
> is now used by icq->__rcu_head in context#1.
> There is a chance that icq could be free'd
> as well.
>
> 22150.386550: <6> Unable to handle kernel write to read-only memory
> at virtual address ffffffaa8d31ca50
Fix looks good to me, applied.
--
Jens Axboe
prev parent reply other threads:[~2020-03-11 12:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-11 10:37 Sahitya Tummala
2020-03-11 12:59 ` Jens Axboe [this message]
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=da11e249-904f-6cec-03b6-ce4b8d7eb1e1@kernel.dk \
--to=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ppvk@codeaurora.org \
--cc=stummala@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
Powered by JetHome