From 8be87129c42292a29566357271779f77c388627d Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 3 Sep 2010 19:33:37 +0000 Subject: [PATCH] Fix possible crash in scst_sched_session_free() because sess got while it's being destroyed after its recf counter already reached 0. To pre vent that it's better to take reference to sess_kobj instead. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2044 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index 8c0158f9d..28ad21660 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -2213,7 +2213,7 @@ static int scst_sysfs_sess_get_active_commands(struct scst_session *sess) res = active_cmds; out_put: - scst_sess_put(sess); + kobject_put(&sess->sess_kobj); TRACE_EXIT_RES(res); return res; @@ -2240,7 +2240,7 @@ static ssize_t scst_sess_sysfs_active_commands_show(struct kobject *kobj, work->sess = sess; - scst_sess_get(sess); + kobject_get(&sess->sess_kobj); res = scst_sysfs_queue_wait_work(work); if (res != -EAGAIN)