Re: [PATCH 1/2] btrfs-progs: Avoid reading bad fd in case of missing device.

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

 



On Fri, Aug 21, 2015 at 11:21:26AM +0800, Qu Wenruo wrote:
> Offline btrfs tools, like btrfs-image, will infinitely loop when there
> is missing device.
> 
> The reason is, for missing device, it's fd will be set to -1, but before
> we reading, we only check the fd validation by checking if it's 0.
> So in that case, -1 will pass the validation check, and cause pread to
> return 0, and loop to read.
> 
> Just change the validation check from "== 0" to "<= 0" to avoid such
> problem.
> 
> Reported-by: Timothy Normand Miller <theosib@xxxxxxxxx>
> Signed-off-by: Qu Wenruo <quwenruo@xxxxxxxxxxxxxx>

Applied, thanks. I'll add a test for that.
--
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