libzfs: Zero DIOCLWEDGES input before ioctl.

Otherwise we ask the kernel to write over whatever random pointer was
in the stack garbage here, when all we wanted was to learn whether
dkwl_nwedges is zero or nonzero.

XXX pullup-9
This commit is contained in:
riastradh 2021-08-28 10:47:45 +00:00
parent ffdf68d692
commit 549613bcf6
1 changed files with 1 additions and 0 deletions

View File

@ -1099,6 +1099,7 @@ zpool_open_func(void *arg)
off_t size;
/* skip devices with wedges */
memset(&dkwl, 0, sizeof(dkwl));
if (native_ioctl(fd, DIOCLWEDGES, &dkwl) == 0 &&
dkwl.dkwl_nwedges > 0) {
(void) close(fd);