Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/iscsi iscsi(4): Fix config_found usage -- needs kern...



details:   https://anonhg.NetBSD.org/src/rev/47fffd16f65e
branches:  trunk
changeset: 361550:47fffd16f65e
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Feb 13 19:03:25 2022 +0000

description:
iscsi(4): Fix config_found usage -- needs kernel lock.

Candidate fix for PR kern/56709.

diffstat:

 sys/dev/iscsi/iscsi_main.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r 1c176ffe4910 -r 47fffd16f65e sys/dev/iscsi/iscsi_main.c
--- a/sys/dev/iscsi/iscsi_main.c        Sun Feb 13 18:29:15 2022 +0000
+++ b/sys/dev/iscsi/iscsi_main.c        Sun Feb 13 19:03:25 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iscsi_main.c,v 1.37 2021/08/07 16:19:12 thorpej Exp $  */
+/*     $NetBSD: iscsi_main.c,v 1.38 2022/02/13 19:03:25 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -359,6 +359,7 @@
        struct scsipi_adapter *adapt = &sess->s_sc_adapter;
        struct scsipi_channel *chan = &sess->s_sc_channel;
        const quirktab_t        *tgt;
+       int found;
 
        mutex_enter(&sess->s_lock);
        sess->s_send_window = max(2, window_size(sess, CCBS_FOR_SCSIPI));
@@ -391,9 +392,12 @@
        chan->chan_nluns = 16;
        chan->chan_id = sess->s_id;
 
+       KERNEL_LOCK(1, NULL);
        sess->s_child_dev = config_found(dev, chan, scsiprint, CFARGS_NONE);
+       found = (sess->s_child_dev != NULL);
+       KERNEL_UNLOCK_ONE(NULL);
 
-       return sess->s_child_dev != NULL;
+       return found;
 }
 
 



Home | Main Index | Thread Index | Old Index