mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Corrected a case where we could read uninited ABD memory
For my sins, I started running valgrind over ztest to try and fix that pesky intermittent "zloop dies with malloc errors" problem. This one seemed exciting enough to merit cutting a PR for before the rest get polished. Suggested-by: Paul Dagnelie <pcd@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rich Ercolani <rincebrain@gmail.com> Closes #12214
This commit is contained in:
parent
ddc026f59b
commit
df42e20ac6
@ -5682,17 +5682,20 @@ arc_read_done(zio_t *zio)
|
||||
zio_crypt_decode_params_bp(bp, hdr->b_crypt_hdr.b_salt,
|
||||
hdr->b_crypt_hdr.b_iv);
|
||||
|
||||
if (BP_GET_TYPE(bp) == DMU_OT_INTENT_LOG) {
|
||||
void *tmpbuf;
|
||||
if (zio->io_error == 0) {
|
||||
if (BP_GET_TYPE(bp) == DMU_OT_INTENT_LOG) {
|
||||
void *tmpbuf;
|
||||
|
||||
tmpbuf = abd_borrow_buf_copy(zio->io_abd,
|
||||
sizeof (zil_chain_t));
|
||||
zio_crypt_decode_mac_zil(tmpbuf,
|
||||
hdr->b_crypt_hdr.b_mac);
|
||||
abd_return_buf(zio->io_abd, tmpbuf,
|
||||
sizeof (zil_chain_t));
|
||||
} else {
|
||||
zio_crypt_decode_mac_bp(bp, hdr->b_crypt_hdr.b_mac);
|
||||
tmpbuf = abd_borrow_buf_copy(zio->io_abd,
|
||||
sizeof (zil_chain_t));
|
||||
zio_crypt_decode_mac_zil(tmpbuf,
|
||||
hdr->b_crypt_hdr.b_mac);
|
||||
abd_return_buf(zio->io_abd, tmpbuf,
|
||||
sizeof (zil_chain_t));
|
||||
} else {
|
||||
zio_crypt_decode_mac_bp(bp,
|
||||
hdr->b_crypt_hdr.b_mac);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user