Skip to content

Commit bd3f204

Browse files
xinyunliuacrnsi
authored andcommitted
dm: hyper_dmabuf: clean up assert
validate fd before use it Tracked-On: #3349 Signed-off-by: Liu Xinyun <xinyun.liu@intel.com> Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
1 parent 5650183 commit bd3f204

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

devicemodel/hw/pci/virtio/virtio_hyper_dmabuf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <stdlib.h>
1616
#include <string.h>
1717
#include <unistd.h>
18-
#include <assert.h>
1918
#include <pthread.h>
2019

2120
#include "dm.h"
@@ -343,8 +342,9 @@ virtio_hyper_dmabuf_deinit(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
343342
virtio_hyper_dmabuf_k_stop();
344343
virtio_hyper_dmabuf_k_reset();
345344
kstatus = VIRTIO_DEV_INITIAL;
346-
assert(vbs_k_hyper_dmabuf_fd >= 0);
347-
close(vbs_k_hyper_dmabuf_fd);
345+
if (vbs_k_hyper_dmabuf_fd >= 0) {
346+
close(vbs_k_hyper_dmabuf_fd);
347+
}
348348
vbs_k_hyper_dmabuf_fd = -1;
349349
}
350350

0 commit comments

Comments
 (0)