public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Zhiqiang Liu <liuzhiqiang26@huawei.com>, paolo.valente@linaro.org
Cc: linux-block <linux-block@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Mingfangsen <mingfangsen@huawei.com>,
	yanxiaodan@huawei.com, "wubo (T)" <wubo40@huawei.com>,
	renxudong <renxudong1@huawei.com>,
	Louhongxiang <louhongxiang@huawei.com>,
	linfeilong@huawei.com, wangwang2@huawei.com
Subject: Re: [PATCH V3] block, bfq: fix use-after-free in bfq_idle_slice_timer_body
Date: Sat, 21 Mar 2020 14:29:57 -0600	[thread overview]
Message-ID: <1052be18-ef45-e254-e1bb-09a7cd6d891f@kernel.dk> (raw)
In-Reply-To: <da33586a-6fc1-0708-e86d-b09e349200f8@huawei.com>

On 3/19/20 5:18 AM, Zhiqiang Liu wrote:
> 
> In bfq_idle_slice_timer func, bfqq = bfqd->in_service_queue is
> not in bfqd-lock critical section. The bfqq, which is not
> equal to NULL in bfq_idle_slice_timer, may be freed after passing
> to bfq_idle_slice_timer_body. So we will access the freed memory.
> 
> In addition, considering the bfqq may be in race, we should
> firstly check whether bfqq is in service before doing something
> on it in bfq_idle_slice_timer_body func. If the bfqq in race is
> not in service, it means the bfqq has been expired through
> __bfq_bfqq_expire func, and wait_request flags has been cleared in
> __bfq_bfqd_reset_in_service func. So we do not need to re-clear the
> wait_request of bfqq which is not in service.

Applied, thanks.

-- 
Jens Axboe


      parent reply	other threads:[~2020-03-21 20:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-19 11:18 [PATCH V3] block, bfq: fix use-after-free in bfq_idle_slice_timer_body Zhiqiang Liu
2020-03-21  9:53 ` Paolo Valente
2020-03-21 20:29 ` 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=1052be18-ef45-e254-e1bb-09a7cd6d891f@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=linfeilong@huawei.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuzhiqiang26@huawei.com \
    --cc=louhongxiang@huawei.com \
    --cc=mingfangsen@huawei.com \
    --cc=paolo.valente@linaro.org \
    --cc=renxudong1@huawei.com \
    --cc=wangwang2@huawei.com \
    --cc=wubo40@huawei.com \
    --cc=yanxiaodan@huawei.com \
    /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