From owner-svn-src-head@FreeBSD.ORG Sun Jun 29 18:38:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3CB94E00; Sun, 29 Jun 2014 18:38:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A19F2F00; Sun, 29 Jun 2014 18:38:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5TIcjgF068536; Sun, 29 Jun 2014 18:38:45 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5TIcjwg068535; Sun, 29 Jun 2014 18:38:45 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201406291838.s5TIcjwg068535@svn.freebsd.org> From: Sean Bruno Date: Sun, 29 Jun 2014 18:38:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r268017 - head/sys/dev/ciss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jun 2014 18:38:45 -0000 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" 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);