From: Miao Xie <miaox@cn.fujitsu.com>
To: Anand Jain <anand.jain@oracle.com>
Cc: <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 1/2] btrfs: fix null pointer dereference in clone_fs_devices when name is null
Date: Wed, 2 Jul 2014 10:38:31 +0800 [thread overview]
Message-ID: <53B370A7.6050108@cn.fujitsu.com> (raw)
In-Reply-To: <53B17D0E.2050302@oracle.com>
On Mon, 30 Jun 2014 23:06:54 +0800, Anand Jain wrote:
>
>> The primary reason of this problem is that we didn't scan the system and
>> find all the devices in the filesystem, if we scan the system, we can
>> mount the filesystem successfully, needn't mount it with degraded option.
>> so I think the right way to fix is to scan the system and find the device
>> that is not registered into the fs device list.
>
> Thanks for commenting. Right. But I am testing the error
> scenario. that is, when one of the disk is missing in the system.
In fact, the disk is still in the system, but is not added into btrfs device list
(we can add it by "btrfs device scan" command), and after you mount the fs with
degraded option, the fs adds that disk as a missing device, so it doesn't has its
name.
Though avoiding access a null pointer is right, you didn't consider the missing
device and forgot to set the missing device counter. I think the following code
is better.
if (orig_dev->missing) {
device->missing = 1;
fs_devices->missing_devices++;
} else {
ASSERT(orig_dev->name);
......
}
Thanks
Miao
next prev parent reply other threads:[~2014-07-02 2:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-30 9:12 [PATCH 1/2] btrfs: fix null pointer dereference in clone_fs_devices when name is null Anand Jain
2014-06-30 9:12 ` [PATCH 2/2] btrfs: fix null pointer dereference in btrfs_show_devname " Anand Jain
2014-06-30 10:02 ` [PATCH 1/2] btrfs: fix null pointer dereference in clone_fs_devices " Miao Xie
2014-06-30 15:06 ` Anand Jain
2014-07-02 2:38 ` Miao Xie [this message]
2014-07-04 11:21 ` Anand Jain
2014-07-04 11:24 ` Anand Jain
2014-07-07 3:05 ` Miao Xie
2014-07-07 9:20 ` Anand Jain
2014-07-07 9:21 ` 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=53B370A7.6050108@cn.fujitsu.com \
--to=miaox@cn.fujitsu.com \
--cc=anand.jain@oracle.com \
--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 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.