mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 11:29:36 +03:00
Fix zdb -E segfault
SPA_MAXBLOCKSIZE is too large for stack. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: loli10K <ezomori.nozomu@gmail.com> Signed-off-by: Chunwei Chen <david.chen@nutanix.com> Closes #7099
This commit is contained in:
parent
18c662b845
commit
31ff122aa2
@ -4139,11 +4139,12 @@ zdb_embedded_block(char *thing)
|
|||||||
{
|
{
|
||||||
blkptr_t bp;
|
blkptr_t bp;
|
||||||
unsigned long long *words = (void *)&bp;
|
unsigned long long *words = (void *)&bp;
|
||||||
char buf[SPA_MAXBLOCKSIZE];
|
char *buf;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
memset(&bp, 0, sizeof (blkptr_t));
|
buf = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL);
|
||||||
|
|
||||||
|
bzero(&bp, sizeof (bp));
|
||||||
err = sscanf(thing, "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx:"
|
err = sscanf(thing, "%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx:"
|
||||||
"%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx",
|
"%llx:%llx:%llx:%llx:%llx:%llx:%llx:%llx",
|
||||||
words + 0, words + 1, words + 2, words + 3,
|
words + 0, words + 1, words + 2, words + 3,
|
||||||
@ -4161,6 +4162,7 @@ zdb_embedded_block(char *thing)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
zdb_dump_block_raw(buf, BPE_GET_LSIZE(&bp), 0);
|
zdb_dump_block_raw(buf, BPE_GET_LSIZE(&bp), 0);
|
||||||
|
umem_free(buf, SPA_MAXBLOCKSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user