From 609603a5d3356c2c69c926038eee6755e0183d27 Mon Sep 17 00:00:00 2001 From: BearBabyLiu Date: Wed, 21 Sep 2016 10:09:22 +0800 Subject: [PATCH] Fix coverity defects coverity scan CID:147504 Type: Explicit null dereferenced Reason: passing null pointer dl to zfs_dirent_unlock Reviewed-by: Brian Behlendorf Signed-off-by: BearBabyLiu Closes #5131 --- module/zfs/zfs_vnops.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index 405b37c1925d..796cd1e342c4 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -1470,8 +1470,10 @@ top: if (S_ISREG(ZTOI(zp)->i_mode) && (vap->va_mask & ATTR_SIZE) && (vap->va_size == 0)) { /* we can't hold any locks when calling zfs_freesp() */ - zfs_dirent_unlock(dl); - dl = NULL; + if (dl) { + zfs_dirent_unlock(dl); + dl = NULL; + } error = zfs_freesp(zp, 0, 0, mode, TRUE); } }