Skip to content

Commit

Permalink
3627: behlendorf/issue-3445 - Check for NULL in dmu_free_long_range_i…
Browse files Browse the repository at this point in the history
…mpl()

A NULL should never be passed as the dnode_t pointer to the function
dmu_free_long_range_impl().  Regardless, because we have a reported
occurrence of this let's add some error handling to catch this.
Better to report a reasonable error to caller than panic the system.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue openzfs#3445
  • Loading branch information
behlendorf authored and FransUrbo committed Jul 27, 2015
1 parent 479f299 commit 2c30c7d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion module/zfs/dmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,9 +644,13 @@ static int
dmu_free_long_range_impl(objset_t *os, dnode_t *dn, uint64_t offset,
uint64_t length)
{
uint64_t object_size = (dn->dn_maxblkid + 1) * dn->dn_datablksz;
uint64_t object_size;
int err;

if (dn == NULL)
return (SET_ERROR(EINVAL));

object_size = (dn->dn_maxblkid + 1) * dn->dn_datablksz;
if (offset >= object_size)
return (0);

Expand Down

0 comments on commit 2c30c7d

Please sign in to comment.