From c7c0672b511797e4297f8c295ca255179c30f0fe Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Thu, 13 Dec 2012 21:06:17 +0000 Subject: [PATCH] Fir corner case handling in vdisk_attach_tgt() Signed-off-by: Bart Van Assche Reported-by: Sebastian Riemer Tested-by: Sebastian Riemer git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4642 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index d58a8787f..90a79e755 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -954,8 +954,10 @@ static int vdisk_attach_tgt(struct scst_tgt_dev *tgt_dev) if (!virt_dev->nullio && !virt_dev->cdrom_empty) { res = vdisk_open_fd(virt_dev); - if (res != 0) + if (res != 0) { + virt_dev->tgt_dev_cnt--; goto out; + } } else virt_dev->fd = NULL;