From 6a6dd2bf08605f3eb6cc97e3bc802b3e50d29d43 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Mon, 20 Jun 2011 20:40:32 +0000 Subject: [PATCH] Fix crash on TP check, if file name is NULL git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3603 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 40fcb18b1..3329a1fd6 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -609,14 +609,14 @@ out: static void vdisk_check_tp_support(struct scst_vdisk_dev *virt_dev) { - struct inode *inode; - struct file *fd; + struct inode *inode = NULL; + struct file *fd = NULL; TRACE_ENTRY(); virt_dev->dev_thin_provisioned = 0; - if (virt_dev->rd_only) + if (virt_dev->rd_only || (virt_dev->filename == NULL)) goto out_check; fd = filp_open(virt_dev->filename, O_LARGEFILE, 0600); @@ -648,7 +648,8 @@ static void vdisk_check_tp_support(struct scst_vdisk_dev *virt_dev) } out_close: - filp_close(fd, NULL); + if (fd != NULL) + filp_close(fd, NULL); out_check: if (virt_dev->thin_provisioned_manually_set) {