Skip to content

Commit 5737823

Browse files
gmelikovamotin
andcommitted
arc_hdr_authenticate: make explicit error
On compression we could be more explicit here for cases where we can not recompress the data. Co-authored-by: Alexander Motin <[email protected]> Signed-off-by: George Melikov <[email protected]>
1 parent 263bbe9 commit 5737823

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

module/zfs/arc.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,9 +1787,13 @@ arc_hdr_authenticate(arc_buf_hdr_t *hdr, spa_t *spa, uint64_t dsobj)
17871787
!HDR_COMPRESSION_ENABLED(hdr)) {
17881788
abd = NULL;
17891789
csize = zio_compress_data(HDR_GET_COMPRESS(hdr),
1790-
hdr->b_l1hdr.b_pabd, &abd, lsize, lsize, hdr->b_complevel);
1790+
hdr->b_l1hdr.b_pabd, &abd, lsize, MIN(lsize, psize),
1791+
hdr->b_complevel);
1792+
if (csize >= lsize || csize > psize) {
1793+
ret = SET_ERROR(EIO);
1794+
return (ret);
1795+
}
17911796
ASSERT3P(abd, !=, NULL);
1792-
ASSERT3U(csize, <=, psize);
17931797
abd_zero_off(abd, csize, psize - csize);
17941798
free_abd = B_TRUE;
17951799
}

0 commit comments

Comments
 (0)