Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jan 2009 21:08:00 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r187652 - head/sys/cam
Message-ID:  <200901232108.n0NL80Y6054397@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 



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