From: Anand Jain <anand.jain@oracle.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 4/9] btrfs: fix UAF due to race between replace start and cancel
Date: Fri, 16 Nov 2018 14:37:19 +0800 [thread overview]
Message-ID: <f3b9d25c-98ed-61fc-3642-697d86a39d9b@oracle.com> (raw)
In-Reply-To: <20181115152543.GR24115@twin.jikos.cz>
On 11/15/2018 11:25 PM, David Sterba wrote:
> On Thu, Nov 15, 2018 at 03:00:21PM +0100, David Sterba wrote:
>> On Wed, Nov 14, 2018 at 09:28:34AM +0800, Anand Jain wrote:
>>>>> mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
>>>>> return result;
>>>>
>>>> There's a compiler warning:
>>>>
>>>> fs/btrfs/dev-replace.c: In function ‘btrfs_dev_replace_cancel’:
>>>> fs/btrfs/dev-replace.c:865:9: warning: ‘result’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>>>> return result;
>>>> ^~~~~~
>>>
>>>> I haven't looked closer though it looks valid.
>>>
>>> int result; is assigned within switch(), so there isn't actual problem.
>>
>> The warning is there because switch (dev_replace->replace_state) does
>> not have a default: case that would catch the values outside of what's
>> defined by the enum. So in that case result would have undefined value.
>>
>>> But will initialize the result to -EINVAL to quite the compiler.
>>> Sending v3.
>>
>> I don't see any change in the followup version.
>> https://patchwork.kernel.org/patch/10681939/
Looks like I didn't run git commit --amend, now pulled your changes
from misc-next.
> I've added
>
> default:
> result = -EINVAL;
>
> to the end of the switch.
Ok. misc-next looks good to me.
Thanks, Anand
next prev parent reply other threads:[~2018-11-16 6:37 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-11 14:22 [PATCH 0/9 v2] fix replace-start and replace-cancel racing Anand Jain
2018-11-11 14:22 ` [PATCH 1/9] btrfs: mark btrfs_dev_replace_start() as static Anand Jain
2018-11-11 14:22 ` [PATCH 2/9] btrfs: replace go back to suspended if target missing Anand Jain
2018-11-11 14:22 ` [PATCH 3/9] btrfs: replace back to suspend state if EXCL OP is running Anand Jain
2018-11-11 14:22 ` [PATCH 4/9] btrfs: fix UAF due to race between replace start and cancel Anand Jain
2018-11-13 17:24 ` David Sterba
2018-11-14 1:28 ` Anand Jain
2018-11-15 14:00 ` David Sterba
2018-11-15 15:25 ` David Sterba
2018-11-16 6:37 ` Anand Jain [this message]
2018-11-14 5:50 ` [PATCH 4/9 v2.1] " Anand Jain
2018-11-11 14:22 ` [PATCH 5/9] btrfs: replace cancel is successful if scrub cancel is successful Anand Jain
2018-11-15 15:27 ` David Sterba
2018-11-16 6:38 ` Anand Jain
2018-11-11 14:22 ` [PATCH 6/9] btrfs: replace's scrub must not be running in replace suspended state Anand Jain
2018-11-11 14:22 ` [PATCH 7/9] btrfs: quiten warn if the replace is canceled at finish Anand Jain
2018-11-15 15:35 ` David Sterba
2018-11-16 12:06 ` Anand Jain
2018-11-16 18:49 ` David Sterba
2018-11-11 14:22 ` [PATCH 8/9] btrfs: user requsted replace cancel is not an error Anand Jain
2018-11-15 15:31 ` David Sterba
2018-11-16 10:29 ` Anand Jain
2018-11-16 11:05 ` Anand Jain
2018-11-11 14:22 ` [PATCH 9/9] btrfs: add explicit check for replace result no error Anand Jain
2018-11-13 17:33 ` [PATCH 0/9 v2] fix replace-start and replace-cancel racing David Sterba
2018-11-15 15:41 ` David Sterba
2018-11-16 9:32 ` Anand Jain
-- strict thread matches above, loose matches on Subject: below --
2018-11-07 11:43 [PATCH 0/9] " Anand Jain
2018-11-07 11:43 ` [PATCH 4/9] btrfs: fix UAF due to race between replace start and cancel Anand Jain
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=f3b9d25c-98ed-61fc-3642-697d86a39d9b@oracle.com \
--to=anand.jain@oracle.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@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 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).