Print this page
935 sv_lyr_open() misses one NULL-pointer check
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Gordon Ross <gwr@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/avs/ns/sv/sv.c
          +++ new/usr/src/uts/common/avs/ns/sv/sv.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   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
       24 + *
       25 + * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
  24   26   */
  25   27  
  26   28  /*
  27   29   * Storage Volume Character and Block Driver (SV)
  28   30   *
  29   31   * This driver implements a simplistic /dev/{r}dsk/ interface to a
  30   32   * specified disk volume that is otherwise managed by the Prism
  31   33   * software.  The SV driver layers itself onto the underlying disk
  32   34   * device driver by changing function pointers in the cb_ops
  33   35   * structure.
↓ open down ↓ 1195 lines elided ↑ open up ↑
1229 1231                  } else {
1230 1232                          ret = (*fn)(devp, flag, otyp, crp);
1231 1233                  }
1232 1234  
1233 1235                  if (ret == 0) {
1234 1236                          /*
1235 1237                           * Re-acquire svp if the driver changed *devp.
1236 1238                           */
1237 1239  
1238 1240                          if (*devp != odev) {
1239      -                                rw_exit(&svp->sv_lock);
     1241 +                                if (svp != NULL)
     1242 +                                        rw_exit(&svp->sv_lock);
1240 1243  
1241 1244                                  svp = sv_dev_to_sv(*devp, NULL);
1242 1245  
1243 1246                                  if (svp) {
1244 1247                                          rw_enter(&svp->sv_lock, RW_READER);
1245 1248                                  }
1246 1249                          }
1247 1250                  }
1248 1251          } else {
1249 1252                  ret = ENODEV;
↓ open down ↓ 1568 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX