Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic wdc_sataprobe: Fix lock leak when atabus_alloc_dr...



details:   https://anonhg.NetBSD.org/src/rev/f48d9aa3e6ab
branches:  trunk
changeset: 986275:f48d9aa3e6ab
user:      rin <rin%NetBSD.org@localhost>
date:      Fri Sep 17 10:15:35 2021 +0000

description:
wdc_sataprobe: Fix lock leak when atabus_alloc_drives() fails.

diffstat:

 sys/dev/ic/wdc.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 516a652adcc6 -r f48d9aa3e6ab sys/dev/ic/wdc.c
--- a/sys/dev/ic/wdc.c  Fri Sep 17 08:13:06 2021 +0000
+++ b/sys/dev/ic/wdc.c  Fri Sep 17 10:15:35 2021 +0000
@@ -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 @@
                    "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.



Home | Main Index | Thread Index | Old Index