HomeFreeBSD

Handle vdev_lookup_top() failure in dva_get_dsize_sync()

Description

Handle vdev_lookup_top() failure in dva_get_dsize_sync()

The dva_get_dsize_sync() function incorrectly assumes that the call
to vdev_lookup_top() cannot fail. However, the NULL dereference at
clearly shows that under certain circumstances it is possible. Note
that offset 0x570 (1376) maps as expected to vd->vdev_deflate_ratio.

BUG: unable to handle kernel NULL pointer dereference at 00000570

crash> struct -o vdev
struct vdev {
     [0] uint64_t vdev_id;
     ... ...
  [1376] uint64_t vdev_deflate_ratio;

Given that this can happen this patch add the required error handling.
In the case where vdev_lookup_top() fails assume that no deflation
will occur for the DVA and use the asize.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Signed-off-by: Alexey Zhuravlev <alexey.zhuravlev@intel.com>
Closes #1707
Closes #1987
Closes #1891

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>

Details

Provenance
Brian Behlendorf <behlendorf1@llnl.gov>Authored on May 5 2014, 6:28 PM
Parents
rG962d52421236: Check the dataset type more rigorously when fetching properties.
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG2c33b9127569: Handle vdev_lookup_top() failure in dva_get_dsize_sync() (authored by Brian Behlendorf <behlendorf1@llnl.gov>).May 6 2014, 5:41 PM