Skip to content

Commit

Permalink
Avoid panic when attempting to raw send without large_blocks
Browse files Browse the repository at this point in the history
Raw sending withouth the feature large_blocks being active is
unsupported and leads to a NULL pointer dereference. Handle this
gracefully by printing an error.

Signed-off-by: George Amanakis <[email protected]>
  • Loading branch information
gamanakis committed Jul 26, 2021
1 parent d8381f5 commit e495a24
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion module/zfs/dmu_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -1963,8 +1963,14 @@ setup_featureflags(struct dmu_send_params *dspp, objset_t *os,
if (dspp->compressok || dspp->rawok)
*featureflags |= DMU_BACKUP_FEATURE_COMPRESSED;

if (dspp->rawok && os->os_encrypted)
if (dspp->rawok && os->os_encrypted) {
*featureflags |= DMU_BACKUP_FEATURE_RAW;
if (!(*featureflags & DMU_BACKUP_FEATURE_LARGE_BLOCKS)) {
cmn_err(CE_WARN, "Raw sending without large_blocks "
"active is unsupported.");
return (SET_ERROR(ENOTSUP));
}
}

if ((*featureflags &
(DMU_BACKUP_FEATURE_EMBED_DATA | DMU_BACKUP_FEATURE_COMPRESSED |
Expand Down

0 comments on commit e495a24

Please sign in to comment.