Skip to contentSkip to conversation

cxgb3i: Fix error path for module init

PATCH In review Roland Dreier 2 participants 2 messages Apr 28, 2010 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cxgb3i: Fix error path for module init

If cxgb3i_pdu_init() fails, then it appears that cxgb3i_iscsi_init() will not be cleaned up, leading to the iscsi transport being left registered. Fix this by adding a call to cxgb3i_iscsi_cleanup() on the error path.

---
 drivers/scsi/cxgb3i/cxgb3i_init.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/scsi/cxgb3i/cxgb3i_init.c +3 -1
index d0ab23a..685af36 100644
@@ -104,8 +104,10 @@ static int __init cxgb3i_init_module(void)
 		return err;
 
 	err = cxgb3i_pdu_init();
-	if (err < 0)
+	if (err < 0) {
+		cxgb3i_iscsi_cleanup();
 		return err;
+	}
 
 	cxgb3_register_client(&t3c_client);
 
Signature · 2 lines
Roland Dreier <[email protected]> || For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/index.html
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Roland Dreier

If cxgb3i_pdu_init() fails, then it appears that cxgb3i_iscsi_init() will not be cleaned up, leading to the iscsi transport being left registered. Fix this by adding a call to cxgb3i_iscsi_cleanup() on the error path.

---
  drivers/scsi/cxgb3i/cxgb3i_init.c |    4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)
drivers/scsi/cxgb3i/cxgb3i_init.c +0 -0
index d0ab23a..685af36 100644
@@ -104,8 +104,10 @@ static int __init cxgb3i_init_module(void)
  		return err;

drivers/scsi/cxgb3i/cxgb3i_init.c static int __init cxgb3i_init_module(void) · line 113

Quoted 10 lines
drivers/scsi/cxgb3i/cxgb3i_init.c +3 -1
 
  	err = cxgb3i_pdu_init();
-	if (err<  0)
+	if (err<  0) {
+		cxgb3i_iscsi_cleanup();
  		return err;
+	}
 
  	cxgb3_register_client(&t3c_client);
 

Looks good to me.