svn commit: r239468 - head/sbin/camcontrol

Sergey Kandaurov pluknet at FreeBSD.org
Mon Aug 20 20:40:15 UTC 2012


Author: pluknet
Date: Mon Aug 20 20:40:14 2012
New Revision: 239468
URL: http://svn.freebsd.org/changeset/base/239468

Log:
  Avoid segfault in the 'smpphylist' subcommand.
  Initialize devlist.dev_queue tail queue early enough before its any
  potential traversal in freebusdevlist() when in smpphylist error path.
  
  Reported by:	Pavel Polyakov <bsd kobyla org> (on irc)
  Reviewed by:	ken
  MFC after:	5 days

Modified:
  head/sbin/camcontrol/camcontrol.c

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Mon Aug 20 19:26:43 2012	(r239467)
+++ head/sbin/camcontrol/camcontrol.c	Mon Aug 20 20:40:14 2012	(r239468)
@@ -5459,6 +5459,7 @@ smpphylist(struct cam_device *device, in
 
 	bzero(&(&ccb->ccb_h)[1],
 	      sizeof(union ccb) - sizeof(struct ccb_hdr));
+	STAILQ_INIT(&devlist.dev_queue);
 
 	rgrequest = malloc(sizeof(*rgrequest));
 	if (rgrequest == NULL) {
@@ -5527,7 +5528,6 @@ smpphylist(struct cam_device *device, in
 		goto bailout;
 	}
 
-	STAILQ_INIT(&devlist.dev_queue);
 	devlist.path_id = device->path_id;
 
 	retval = buildbusdevlist(&devlist);


More information about the svn-src-all mailing list