LKML Archive on
help / color / mirror / Atom feed
From: Guoqing Jiang <>
To: Song Liu <>, lwt105 <>
Cc: linux-raid <>,
	open list <>
Subject: Re: [PATCH] drivers:md:fix a potential use-after-free bug
Date: Tue, 17 Aug 2021 15:47:16 +0800	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On 8/14/21 12:16 AM, Song Liu wrote:
> On Thu, Aug 12, 2021 at 8:46 PM lwt105<>  wrote:
>> In line 2867, "raid5_release_stripe(sh);" drops the reference to sh and
>> may cause sh to be released. However, sh is subsequently used in lines
>> 2869 "if (sh->batch_head && sh != sh->batch_head)". This may result in an
>> use-after-free bug.
>> It can be fixed by moving "raid5_release_stripe(sh);" to the bottom of
>> the function.
>> Signed-off-by: lwt105<>
> The fix looks reasonable.

I am not sure this is needed unless there is real calltrace to prove it. 
Because raid5_release_stripe
doesn't mean it will release the sh's memory,  pls see the comment 
before clear_batch_ready in
handle_stripe, and the path handle_stripe -> handle_stripe_clean_event 
-> break_stripe_batch_list.


  reply	other threads:[~2021-08-17  7:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2021-08-13 16:16 ` Song Liu
2021-08-17  7:47   ` Guoqing Jiang [this message]
2022-07-28 11:39 Wentao_Liang
2022-07-28  5:55 ` Song Liu

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \
    --subject='Re: [PATCH] drivers:md:fix a potential use-after-free bug' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).