mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-23 21:51:27 +00:00
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. (Merge r4388 from trunk) git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4451 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -3696,11 +3696,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)
|
||||
@@ -3708,6 +3712,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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user