Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Oct 2012 15:18:16 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r241938 - stable/9/sys/cam
Message-ID:  <201210231518.q9NFIGjG094779@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Oct 23 15:18:16 2012
New Revision: 241938
URL: http://svn.freebsd.org/changeset/base/241938

Log:
  MFC r241405:
  Really handle xpt_compile_path() error in xpt_bus_register() instead of
  print error message and probably crash just after it on NULL dereference.

Modified:
  stable/9/sys/cam/cam_xpt.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/cam_xpt.c
==============================================================================
--- stable/9/sys/cam/cam_xpt.c	Tue Oct 23 15:16:50 2012	(r241937)
+++ stable/9/sys/cam/cam_xpt.c	Tue Oct 23 15:18:16 2012	(r241938)
@@ -3898,8 +3898,11 @@ xpt_bus_register(struct cam_sim *sim, de
 
 	status = xpt_compile_path(path, /*periph*/NULL, sim->path_id,
 				  CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
-	if (status != CAM_REQ_CMP)
-		printf("xpt_compile_path returned %d\n", status);
+	if (status != CAM_REQ_CMP) {
+		xpt_release_bus(new_bus);
+		free(path, M_CAMXPT);
+		return (CAM_RESRC_UNAVAIL);
+	}
 
 	xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL);
 	cpi.ccb_h.func_code = XPT_PATH_INQ;



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