mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
Don't panic on bad SA_MAGIC in sa_build_index
If sa_build_index() encounters a corrupt buffer, don't panic. Add info to zfs ring buffer and return EIO. This allows for a cleaner error recovery path. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com> Issue #6500 Closes #7487
This commit is contained in:
parent
7106b23640
commit
fba33c3819
@ -1284,7 +1284,13 @@ sa_build_index(sa_handle_t *hdl, sa_buf_type_t buftype)
|
||||
/* only check if not old znode */
|
||||
if (IS_SA_BONUSTYPE(bonustype) && sa_hdr_phys->sa_magic != SA_MAGIC &&
|
||||
sa_hdr_phys->sa_magic != 0) {
|
||||
VERIFY(BSWAP_32(sa_hdr_phys->sa_magic) == SA_MAGIC);
|
||||
if (BSWAP_32(sa_hdr_phys->sa_magic) != SA_MAGIC) {
|
||||
mutex_exit(&sa->sa_lock);
|
||||
zfs_dbgmsg("Buffer Header: %x != SA_MAGIC:%x "
|
||||
"object=%#llx\n", sa_hdr_phys->sa_magic, SA_MAGIC,
|
||||
db->db.db_object);
|
||||
return (SET_ERROR(EIO));
|
||||
}
|
||||
sa_byteswap(hdl, buftype);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user