DragonFlyBSD Kernel Audit
DF-2032 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/raid/tws/tws_user.c b/sys/dev/raid/tws/tws_user.c
--- a/sys/dev/raid/tws/tws_user.c
+++ b/sys/dev/raid/tws/tws_user.c
@@ -268,6 +268,9 @@
     struct tws_lock_packet lpkt;
     time_t ctime;
 
+    /* DF-2032: zero the whole struct so driver_version[14..31] is not
+     * leaked as kernel-stack residue to userspace. */
+    bzero(&cpkt, sizeof(cpkt));
     lockmgr(&sc->gen_lock, LK_EXCLUSIVE);
     ubuf->driver_pkt.status = 0;
     switch(cmd) {