diff options
author | pluknet <pluknet@FreeBSD.org> | 2012-08-20 20:40:14 +0000 |
---|---|---|
committer | pluknet <pluknet@FreeBSD.org> | 2012-08-20 20:40:14 +0000 |
commit | 5dea9601adb2dbdd6661aa81c00dee641b86480d (patch) | |
tree | bbe3033e654807c1dde66a1ff543835a228aab09 /sbin/camcontrol | |
parent | cefce0e7d0d92e82c72935c1595658b3329f35c0 (diff) | |
download | FreeBSD-src-5dea9601adb2dbdd6661aa81c00dee641b86480d.zip FreeBSD-src-5dea9601adb2dbdd6661aa81c00dee641b86480d.tar.gz |
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
Diffstat (limited to 'sbin/camcontrol')
-rw-r--r-- | sbin/camcontrol/camcontrol.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index 342b6dc..0ffd10e 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -5459,6 +5459,7 @@ smpphylist(struct cam_device *device, int argc, char **argv, 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, int argc, char **argv, goto bailout; } - STAILQ_INIT(&devlist.dev_queue); devlist.path_id = device->path_id; retval = buildbusdevlist(&devlist); |