From: ngie Date: Sat, 17 Oct 2015 09:07:53 +0000 (+0000) Subject: Set dev->fd to -1 when calling cam_close_spec_device with a valid dev->fd X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8274c9ca5f94449626c9a69121df86e5d6ffeb1e;p=people%2Fjulieng%2Ffreebsd.git Set dev->fd to -1 when calling cam_close_spec_device with a valid dev->fd descriptor to avoid trashing valid file descriptors that access dev->fd at a later point in time PR: 192671 Submitted by: Scott Ferris MFC after: 1 week Sponsored by: EMC / Isilon Storage Division --- diff --git a/lib/libcam/camlib.c b/lib/libcam/camlib.c index f3202470a0e2..b7024a6d6097 100644 --- a/lib/libcam/camlib.c +++ b/lib/libcam/camlib.c @@ -676,8 +676,10 @@ cam_close_spec_device(struct cam_device *dev) if (dev == NULL) return; - if (dev->fd >= 0) + if (dev->fd >= 0) { close(dev->fd); + dev->fd = -1; + } } char *