Take "sc_lock" after calling disk_ioctl() to make GPT partitioning work.

This commit is contained in:
hannken 2019-05-26 10:22:07 +00:00
parent 9add7bb543
commit eeb3ed56d8
1 changed files with 4 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: md.c,v 1.80 2018/03/03 19:26:12 christos Exp $ */
/* $NetBSD: md.c,v 1.81 2019/05/26 10:22:07 hannken Exp $ */
/*
* Copyright (c) 1995 Gordon W. Ross, Leo Weppelman.
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.80 2018/03/03 19:26:12 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.81 2019/05/26 10:22:07 hannken Exp $");
#ifdef _KERNEL_OPT
#include "opt_md.h"
@ -479,21 +479,19 @@ mdioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
if ((sc = device_lookup_private(&md_cd, MD_UNIT(dev))) == NULL)
return ENXIO;
mutex_enter(&sc->sc_lock);
if (sc->sc_type != MD_UNCONFIGURED) {
error = disk_ioctl(&sc->sc_dkdev, dev, cmd, data, flag, l);
if (error != EPASSTHROUGH) {
mutex_exit(&sc->sc_lock);
return 0;
return error;
}
}
/* If this is not the raw partition, punt! */
if (DISKPART(dev) != RAW_PART) {
mutex_exit(&sc->sc_lock);
return ENOTTY;
}
mutex_enter(&sc->sc_lock);
umd = (struct md_conf *)data;
error = EINVAL;
switch (cmd) {