Re: [PATCH 1/2] btrfs: fix null pointer dereference in clone_fs_devices when name is null

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux