Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Jun 2014 18:38:45 +0000 (UTC)
From:      Sean Bruno <sbruno@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r268017 - head/sys/dev/ciss
Message-ID:  <201406291838.s5TIcjwg068535@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sbruno
Date: Sun Jun 29 18:38:44 2014
New Revision: 268017
URL: http://svnweb.freebsd.org/changeset/base/268017

Log:
  Check return of cam_periph_find() before using it in a printf.
  
  If cam_periph_find() doesn't locate the path we requested, bail to error
  condition.
  
  Acquire ciss->mtx for this operation.
  
  Reviewed by:	"Benesh, Scott" <scott.benesh@hp.com>
  MFC after:	2 weeks

Modified:
  head/sys/dev/ciss/ciss.c

Modified: head/sys/dev/ciss/ciss.c
==============================================================================
--- head/sys/dev/ciss/ciss.c	Sun Jun 29 09:29:27 2014	(r268016)
+++ head/sys/dev/ciss/ciss.c	Sun Jun 29 18:38:44 2014	(r268017)
@@ -3429,13 +3429,17 @@ ciss_name_device(struct ciss_softc *sc, 
 			     target, 0);
 
     if (status == CAM_REQ_CMP) {
+	mtx_lock(&sc->ciss_mtx);
 	xpt_path_lock(path);
 	periph = cam_periph_find(path, NULL);
-	sprintf(sc->ciss_logical[bus][target].cl_name, "%s%d",
-		periph->periph_name, periph->unit_number);
 	xpt_path_unlock(path);
+	mtx_unlock(&sc->ciss_mtx);
 	xpt_free_path(path);
-	return(0);
+	if (periph != NULL) {
+		sprintf(sc->ciss_logical[bus][target].cl_name, "%s%d",
+			periph->periph_name, periph->unit_number);
+		return(0);
+	}
     }
     sc->ciss_logical[bus][target].cl_name[0] = 0;
     return(ENOENT);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406291838.s5TIcjwg068535>