Skip to content

Commit

Permalink
Linux: Suppress clang static analyzer warning in zfs_remove()
Browse files Browse the repository at this point in the history
Clang's static analyzer points out that if we fail to find an extended
attribute directory, but somehow find it when calculating delete_now and
delete_now is true, we will have a NULL pointer dereference when we try
to unlink the extended attribute directory.

I am not sure if this is possible, but if it is, I do not see a sane way
of handling this other than rolling back the transaction and retrying.
For now, let us do an VERIFY_IMPLY(). If this trips, it will stop the
transaction from committing, which will prevent an attribute directory
leak.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes openzfs#14575
  • Loading branch information
ryao authored and behlendorf committed Mar 8, 2023
1 parent c2550a1 commit 66a38fd
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions module/os/linux/zfs/zfs_vnops_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 1089,7 @@ zfs_remove(znode_t *dzp, char *name, cred_t *cr, int flags)
!zn_has_cached_data(zp, 0, LLONG_MAX) &&
xattr_obj == xattr_obj_unlinked &&
zfs_external_acl(zp) == acl_obj;
VERIFY_IMPLY(xattr_obj_unlinked, xzp);
}

if (delete_now) {
Expand Down

0 comments on commit 66a38fd

Please sign in to comment.