svn commit: r187652 - head/sys/cam

Edward Tomasz Napierala trasz at FreeBSD.org
Fri Jan 23 13:08:01 PST 2009


Author: trasz
Date: Fri Jan 23 21:08:00 2009
New Revision: 187652
URL: http://svn.freebsd.org/changeset/base/187652

Log:
  Protect against NULL pointer dereference.
  
  Reviewed by:	scottl
  Approved by:	rwatson (mentor)
  Sponsored by:	FreeBSD Foundation

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==============================================================================
--- head/sys/cam/cam_xpt.c	Fri Jan 23 21:06:16 2009	(r187651)
+++ head/sys/cam/cam_xpt.c	Fri Jan 23 21:08:00 2009	(r187652)
@@ -5194,6 +5194,11 @@ xpt_scan_bus(struct cam_periph *periph, 
 		/* Save some state for use while we probe for devices */
 		scan_info = (xpt_scan_bus_info *)
 		    malloc(sizeof(xpt_scan_bus_info), M_CAMXPT, M_NOWAIT);
+		if (scan_info == NULL) {
+			request_ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
+			xpt_done(request_ccb);
+			return;
+		}
 		scan_info->request_ccb = request_ccb;
 		scan_info->cpi = &work_ccb->cpi;
 


More information about the svn-src-head mailing list