Take channel lock for calling reset_drive.

Should fix PR 54217.
This commit is contained in:
mlelstv 2019-06-06 20:55:43 +00:00
parent 5e507e65ea
commit c8f70c2785
1 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: wd.c,v 1.451 2019/06/06 20:41:04 mlelstv Exp $ */
/* $NetBSD: wd.c,v 1.452 2019/06/06 20:55:43 mlelstv Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.451 2019/06/06 20:41:04 mlelstv Exp $");
__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.452 2019/06/06 20:55:43 mlelstv Exp $");
#include "opt_ata.h"
#include "opt_wd.h"
@ -1663,6 +1663,7 @@ int
wd_get_params(struct wd_softc *wd, uint8_t flags, struct ataparams *params)
{
int retry = 0;
struct ata_channel *chp = wd->drvp->chnl_softc;
again:
switch (wd->atabus->ata_get_params(wd->drvp, flags, params)) {
@ -1671,7 +1672,9 @@ again:
case CMD_ERR:
if (retry == 0) {
retry++;
ata_channel_lock(chp);
(*wd->atabus->ata_reset_drive)(wd->drvp, flags, NULL);
ata_channel_unlock(chp);
goto again;
}