Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet/dist/lib/libzfs/common libzfs: Zero DIOC...



details:   https://anonhg.NetBSD.org/src/rev/4366af4b9ee1
branches:  trunk
changeset: 985482:4366af4b9ee1
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Aug 28 10:47:45 2021 +0000

description:
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

diffstat:

 external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff -r 8d6352e5eda0 -r 4366af4b9ee1 external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c
--- a/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c        Sat Aug 28 10:29:15 2021 +0000
+++ b/external/cddl/osnet/dist/lib/libzfs/common/libzfs_import.c        Sat Aug 28 10:47:45 2021 +0000
@@ -1099,6 +1099,7 @@
        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);



Home | Main Index | Thread Index | Old Index