scst: sysfs session creation error path fix

The attached patch prevents that a kernel oops is triggered if something
fails when adding a session to sysfs.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4388 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2012-06-28 22:43:19 +00:00
parent e80a15bfd3
commit c531f06b32
+11 -1
View File
@@ -3648,11 +3648,15 @@ restart:
sess->tgt->tgtt->sess_attrs);
if (res != 0) {
PRINT_ERROR("Can't add attributes for session %s", name);
goto out_free;
goto out_del;
}
}
res = scst_create_sess_luns_link(sess);
if (res != 0) {
PRINT_ERROR("Can't add LUN links for session %s", name);
goto out_del;
}
out_free:
if (name != sess->initiator_name)
@@ -3660,6 +3664,12 @@ out_free:
TRACE_EXIT_RES(res);
return res;
out_del:
kobject_del(&sess->sess_kobj);
kobject_put(&sess->sess_kobj);
sess->sess_kobj_ready = 0;
goto out_free;
}
/*