On Wed, Jun 20, 2018 at 03:38:58PM +0800, Qu Wenruo wrote:
> Commit f8f84b2dfda5 ("btrfs: index check-integrity state hash by a dev_t")
> changed how btrfsic how we index device state hash.
>
> Now we need to access device->bdev->bd_dev, while for degraded mount
> it's completely possible to have device->bdev as NULL, thus it will
> trigger a NULL pointer dereference at mount time.
>
> Fix it by checking if the device is degraded before accessing
> device->bdev->bd_dev.
>
> There are a lot of other places accessing device->bdev->bd_dev, however
> the other call sites have either checked device->bdev, or the
> device->bdev is passed from btrfsic_map_block(), so it won't cause harm.
>
> Fixes: f8f84b2dfda5 ("btrfs: index check-integrity state hash by a dev_t")
> Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
Added to misc-next. As it is a fix it could go to 4.18 but I'd rather
have a good reason for that because it's in a debugging feature.
> ---
> Please note there are still quite some problem about check-integrity,
> including:
> 1) Warning for degraded mount
> 2) Meaningless empty lines output
>
> This patch will only fix the obvious NULL pointer dereference exposed by
> btrfs/027 with "check_int" mount option.
Ok.
--
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