target: fix destroy device in target_configure_device

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/c82b59e7c3f81059b1d280e21028c7ac8451dd52
Commit:     c82b59e7c3f81059b1d280e21028c7ac8451dd52
Parent:     892782caf19a97ccc95df51b3bb659ecacff986a
Refname:    refs/heads/master
Author:     tangwenji <[email protected]>
AuthorDate: Mon Jan 15 20:09:37 2018 +0800
Committer:  Nicholas Bellinger <[email protected]>
CommitDate: Thu Jan 18 01:21:11 2018 -0800

    target: fix destroy device in target_configure_device
    
    After dev->transport->configure_device succeeds, target_configure_device
    exits abnormally, dev_flags has not set DF_CONFIGURED yet, does not call
    destroy_device function in free_device.
    
    Signed-off-by: tangwenji <[email protected]>
    Acked-by: Mike Christie <[email protected]>
    Signed-off-by: Nicholas Bellinger <[email protected]>
---
 drivers/target/target_core_device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index e8dd6da164b2..e27db4d45a9d 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -997,7 +997,7 @@ int target_configure_device(struct se_device *dev)
 
 	ret = core_setup_alua(dev);
 	if (ret)
-		goto out_free_index;
+		goto out_destroy_device;
 
 	/*
 	 * Startup the struct se_device processing thread
@@ -1041,6 +1041,8 @@ int target_configure_device(struct se_device *dev)
 
 out_free_alua:
 	core_alua_free_lu_gp_mem(dev);
+out_destroy_device:
+	dev->transport->destroy_device(dev);
 out_free_index:
 	mutex_lock(&device_mutex);
 	idr_remove(&devices_idr, dev->dev_index);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.