Fix sleeping race during malloc in sysctl hw.disknames.
authorbluhm <bluhm@openbsd.org>
Tue, 24 Sep 2024 12:37:11 +0000 (12:37 +0000)
committerbluhm <bluhm@openbsd.org>
Tue, 24 Sep 2024 12:37:11 +0000 (12:37 +0000)
commitdd2b8016139a630eb8d411270a9d8b90c9dd880b
tree6b259bab8196c6a033b4d27b0ad5f7df963cd010
parent8aa961cf3a4215206ca98474d59581375916c430
Fix sleeping race during malloc in sysctl hw.disknames.

When mallocarray(9) sleeps, disk_count can change, and diskstatslen
gets inconsistent.  This caused free(9) to panic.

Reported-by: syzbot+36e1f3b306f721f90c72@syzkaller.appspotmail.com
OK deraadt@ mpi@
sys/kern/kern_sysctl.c