Print this page
OS-68 cfgadm can cause kernel panic when trying to configure a retired device

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/scsi/impl/scsi_hba.c
          +++ new/usr/src/uts/common/io/scsi/impl/scsi_hba.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  24   25   * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  25   26   * Copyright (c) 2016 by Delphix. All rights reserved.
  26   27   */
  27   28  
  28   29  #include <sys/note.h>
  29   30  
  30   31  /*
  31   32   * Generic SCSI Host Bus Adapter interface implementation
  32   33   */
  33   34  #include <sys/scsi/scsi.h>
↓ open down ↓ 3059 lines elided ↑ open up ↑
3093 3094          uint_t                  bus_state;
3094 3095          int                     rv = 0;
3095 3096          int                     circ;
3096 3097          char                    *name;
3097 3098          char                    *addr;
3098 3099  
3099 3100          self = e_ddi_hold_devi_by_dev(dev, 0);
3100 3101          if (self == NULL) {
3101 3102                  rv = ENXIO;
3102 3103                  goto out;
     3104 +        }
     3105 +
     3106 +        if (DEVI(self)->devi_flags & (DEVI_RETIRED | DEVI_RETIRING)) {
     3107 +                rv = ENXIO;
     3108 +                goto out;
3103 3109          }
3104 3110  
3105 3111          tran = ddi_get_driver_private(self);
3106 3112          if (tran == NULL) {
3107 3113                  rv = ENXIO;
3108 3114                  goto out;
3109 3115          }
3110 3116  
3111 3117          /* Ioctls for which the generic implementation suffices. */
3112 3118          switch (cmd) {
↓ open down ↓ 7376 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX