Module Name:    src
Committed By:   rin
Date:           Fri Sep 17 10:15:35 UTC 2021

Modified Files:
        src/sys/dev/ic: wdc.c

Log Message:
wdc_sataprobe: Fix lock leak when atabus_alloc_drives() fails.


To generate a diff of this commit:
cvs rdiff -u -r1.306 -r1.307 src/sys/dev/ic/wdc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/wdc.c
diff -u src/sys/dev/ic/wdc.c:1.306 src/sys/dev/ic/wdc.c:1.307
--- src/sys/dev/ic/wdc.c:1.306	Mon Jan  4 15:14:32 2021
+++ src/sys/dev/ic/wdc.c	Fri Sep 17 10:15:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdc.c,v 1.306 2021/01/04 15:14:32 skrll Exp $ */
+/*	$NetBSD: wdc.c,v 1.307 2021/09/17 10:15:35 rin Exp $ */
 
 /*
  * Copyright (c) 1998, 2001, 2003 Manuel Bouyer.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.306 2021/01/04 15:14:32 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.307 2021/09/17 10:15:35 rin Exp $");
 
 #include "opt_ata.h"
 #include "opt_wdc.h"
@@ -245,8 +245,10 @@ wdc_sataprobe(struct ata_channel *chp)
 		    "cl=0x%x ch=0x%x\n",
 		    device_xname(chp->ch_atac->atac_dev), chp->ch_channel,
 		    sc, sn, cl, ch), DEBUG_PROBE);
-		if (atabus_alloc_drives(chp, wdc->wdc_maxdrives) != 0)
+		if (atabus_alloc_drives(chp, wdc->wdc_maxdrives) != 0) {
+			ata_channel_unlock(chp);
 			return;
+		}
 		/*
 		 * sc and sn are supposed to be 0x1 for ATAPI, but in some
 		 * cases we get wrong values here, so ignore it.

Reply via email to